解决veu项目编译速度慢的问题

主要在热更新这一块解决。

 

step1:

安装依赖

npm install babel-plugin-dynamic-import-node

step2:

在webpack.prod.conf.js文件设置:

new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false,
        drop_console: true,
        drop_debugger: true
      },
      sourceMap: true,
      ecma: 6,
      cache: true,
      parallel: true
    }),

step3:

在webpack.base.conf.js文件设置,排除node——modules:

module: {
    rules: [
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: vueLoaderConfig
      },
      {
        test: /\.js$/,
        loader: 'babel-loader',
        // include: [resolve('src'), resolve('test')]
        include: [resolve('src'), resolve('test')],
        exclude:/(node_modules)/ //主要这一句
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        loader: 'url-loader?limit=8192',
        query: {
          limit: 10000,
 

你可能感兴趣的:(前端框架vue)