2017-09-18 440 views
2
使用plotly.js 3D scatter3d用的WebPack

我試圖運行具有的WebPack和Vue.js在Vue公司

plotly.js簡單的情節狀散射它的正常工作具有以下配置:

上webpack.config.js

loaders: [ 
     { 
      test: /node_modules/, 
      loader: 'ify-loader' 
     }, 

    ], 

,並在VUE文件導入我用下面的代碼:

var Plotly = require('plotly.js/lib/core'); 
Plotly.register([ 
    require('plotly.js/lib/scatter'), 
    require('plotly.js/lib/scatter3d'), 
]); 

與散射一切正常,但是當我嘗試使用:

type: 'scatter3d', 

我收到以下錯誤:

It appears that you're using glslify in browserify without its transform applied. Make sure that you've set up glslify as a source transform: 
通過我的理解

所以,我需要讓IFY裝載機過程中我的文件項目除了node_modules之外。

我已經試圖插入變換對我的項目在GitHub的自述Link for the docs但既不測試工作(是.js和.vue)作爲推薦:

是.js

loaders: [ 
     { 
      test: /\.js$/, 
      loader: 'ify-loader', 
      enforce: 'post' 
     } 
    ] 

帶。 vue

loaders: [ 
     { 
      test: /\.vue$/, 
      loader: 'ify-loader', 
      enforce: 'post' 
     } 
    ] 

任何提示,或線索如何進行?

回答

0
import Plotly from 'plotly.js/dist/plotly.min' 
+0

雖然這段代碼可能會回答這個問題,但是提供關​​於**如何**和**爲什麼**的附加上下文會解決問題,從而提高答案的長期價值。 – Alexander