2017-09-18 354 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