我正在尝试按照入门指南安装名为Vux的npm包。它基本上是用Vue.js编写的UI。该指南说我需要修改Webpack配置文件以包含vux加载器。一切看起来都非常简单,我的配置文件应该像这样:
const vuxLoader = require('vux-loader')
const webpackConfig = originalConfig
module.exports = vuxLoader.merge(webpackConfig, {
plugins: ['vux-ui']
})
我有一个由Rails / Webpacker生成的普通Webpacker配置文件,在关注文档之后,它看起来像是这样:
# config/webpack/environment.js
const { environment } = require('@rails/webpacker')
const vuxLoader = require('vux-loader')
module.exports = vuxLoader.merge(environment, {
plugins: ['vux-ui']
})
您可以在git hub here
上看到该文件但是,在更改之后,Webpack会抛出:
/Volumes/SUPPORT/Workspace/Personal/hcpl/node_modules/vux-loader/src/index.js:285
config.plugins.push(new webpack.LoaderOptionsPlugin({
^
TypeError: config.plugins.push is not a function
at Function.module.exports.merge (/Volumes/SUPPORT/Workspace/Personal/hcpl/node_modules/vux-loader/src/index.js:285:20)
at Object.<anonymous> (/Volumes/SUPPORT/Workspace/Personal/hcpl/config/webpack/environment.js:7:28)
at Module._compile (module.js:641:30)
at Object.Module._extensions..js (module.js:652:10)
at Module.load (module.js:560:32)
at tryModuleLoad (module.js:503:12)
at Function.Module._load (module.js:495:3)
at Module.require (module.js:585:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Volumes/SUPPORT/Workspace/Personal/hcpl/config/webpack/development.js:1:83)
有谁知道我在这里做错了什么?我对Webpack没有太多经验,也没有Webpacker设置使得从互联网上找到/测试任何解决方案变得更加复杂。