使用vux报错Failed to mount component:template or render function

我按照vux文档配置了webpack.config.js,然后就报这个错,我又查了下说是改resolve里的alias就可以,可我改完了还是不管用

clipboard.png

这是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']
})
阅读 3.5k
2 个回答

我也遇到这个问题了,鼓捣了一下午了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏