1、vue-cli初始运行项目报错

安装vue-cli:直接npm i vue-cli -g,然后直接vue init webpack projectname,然后进入目录,npm run dev即可,如果报错:Module build failed: Error: "extract-text-webpack-plugin" loader is used without the corresponding plugin, refer to https://github.com/webpack/extract-text-webpack-plugin for the usage example,解决方法如下:

在 webpack.dev.conf.js 中添加 extract-text-webpack-plugin 配置如下

const ExtractTextPlugin = require('extract-text-webpack-plugin')

........


plugins: [
    .............
    // extract css into its own file
    new ExtractTextPlugin({
      filename: utils.assetsPath('css/[name].[contenthash].css'),
      // set the following option to `true` if you want to extract CSS from
      // codesplit chunks into this main css file as well.
      // This will result in *all* of your app's CSS being loaded upfront.
      allChunks: false,
    }),
]

参照:https://my.oschina.net/dkvirus/blog/1583258

 

相关文章:

  • 2021-06-11
  • 2022-02-12
  • 2021-09-25
  • 2022-12-23
  • 2021-07-17
  • 2022-02-18
  • 2022-12-23
猜你喜欢
  • 2021-04-30
  • 2021-10-27
  • 2021-10-04
  • 2021-07-29
  • 2021-05-02
相关资源
相似解决方案