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,
}),
]