以下是自己初学webpack的时候会犯的错误,记录下来以备以后翻阅。
-
加载lodash依赖的时候,需要安装在生产依赖而不是开发依赖中:
-
dependencies:使用当前包所需要的依赖
-
devDependencies:一些模块在开发时需要依赖。配置这个属性可以提示包的后续开发者安装依赖包。
$ sudo cnpm install lodash -S
-
加载html-webpack-plugin插件的时候,忘记了配置文件应该怎么写了:
const path = require("path"); const htmlWebpackPlugin = require("html-webpack-plugin"); const htmlPlugin = new htmlWebpackPlugin({ template: path.join(__dirname