webpack.config.js
entry : {
resume : "./src/js/index.js"
},
output : {
filename : "js/[name].js",
path: __dirname +"/dist"
},
module : {
rules : [
{
test : /\.less/,
use : extractTextWebpackPlugin.extract({
fallback : "style-loader",
use : [
{loader : "css-loader"},
{loader : "less-loader"}
]
})
},
{
test: /\.(gif|png|jpg|woff|svg|eot|ttf)\??.*$/,
use : [
{
loader : "url-loader",
options : {
limit : 200
}
}
]
}
]
},
devServer : {
hot : true,
inline : true
},
plugins : [
new webpack.optimize.CommonsChunkPlugin({
name: "common",
filename: "js/base.js"
}),
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin(getHtmlConfig("resume","")),
new extractTextWebpackPlugin({
filename : "css/[name].css"
})
]
package.json
"devDependencies": {
"extract-text-webpack-plugin": "^3.0.2",
"html-webpack-plugin": "^3.2.0",
"less": "^3.0.4",
"webpack": "^3.6.0",
"webpack-dev-server": "^2.9.7"
},
"scripts": {
"dev": "node_modules/.bin/webpack-dev-server --inline",
"webpack": "node_modules/.bin/webpack"
},