首页 > 解决方案 > Meteor - webpack 和 ecmascript 都在尝试处理 *.jsx

问题描述

所以我试图在 Meteor 中安装和使用react-wavesurfer,它是现有 js 库(wavesurfer.js)的反应组件包装器。它要求将 wavesurfer.js 文件(必须单独安装)作为全局变量提供。

建议为此使用 webpack,如下所示:

// provide WaveSurfer as a globally accessible variable
plugins: [
  new webpack.ProvidePlugin({
    WaveSurfer: 'wavesurfer.js'
  })
],
// Alias `wavesurfer` to the correct wavesurfer package.
// (wavesurfer.js has some non-standard naming convention)
resolve: {
  alias: {
    wavesurfer: require.resolve('wavesurfer.js')
  }
},

我从未使用过 Webpack(不完全确定它的作用),而且我是 Meteor / React 新手。

所以我安装了:

meteor add webpack:webpack

现在我在控制台中收到以下错误:

While determining active plugins:
error: conflict: two packages included in the app (webpack:webpack and ecmascript) are both trying to handle *.js
error: conflict: two packages included in the app (webpack:webpack and ecmascript) are both trying to handle *.jsx

从错误中我假设ecmascript(再次我一无所知)正在做与 webpack 类似的工作,这导致了冲突?

所以,我的问题......我该如何设置ecmascript呢?我真的不知道!

标签: reactjsmeteorwebpackecmascript-6

解决方案


尝试使用我仍然维护的新包 https://github.com/ardatan/meteor-webpack


推荐阅读