我按照vux文档配置了webpack.config.js,然后就报这个错,我又查了下说是改resolve里的alias就可以,可我改完了还是不管用
这是webpack.config.js
const path = require("path");
const htmlWebpackPlugin = require("html-webpack-plugin");
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const vuxLoader = require('vux-loader')
const webpackConfig = {
mode: 'development',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
resolve: {
alias: {
"vue$": 'vue/dist/vue.js'
},
extensions: ['.js', '.vue', '.json', '.less'],
},
plugins: [
new htmlWebpackPlugin({
template: path.join(__dirname, './src/index.html'),
filename: 'index.html'
}),
// make sure to include the plugin for the magic
new VueLoaderPlugin()
],
module: {
rules: [
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
{ test: /\.less$/, use: ['style-loader', 'css-loader', 'less-loader'] },
{ test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'] },
{ test: /\.(jpg|png|gif|bmp|jpeg)$/, use: 'url-loader ' },
{ test: /\.(ttf|eot|svg|woff|woff2)$/, use: 'url-loader' },
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
{ test: /\.vue$/, use: 'vue-loader' }
]
}
};
module.exports = vuxLoader.merge(webpackConfig, {
plugins: ['vux-ui']
})
我也遇到这个问题了,鼓捣了一下午了