【发布时间】:2021-05-18 20:06:08
【问题描述】:
我正在使用 webpack 来观察我的代码中的变化。代码编译成功,但我去浏览器看不到任何东西。
package.json
"dev:server": "webpack server --hot",
"prod:build": "webpack"
项目结构
- webpack.config.js
- package.json
- src/
- index.hbs
- sass/
- js/
webpack.config.json
module.exports = {
entry: {
"main-page": "./src/js/index.js",
},
output: {
filename: "bundle.[name].[contenthash].js",
path: path.resolve(__dirname, "./dist"),
publicPath: "dist/",
},
mode: "production",
module: ,
optimization:,
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ["**/*"],
}),
new HTMLWebpackPlugin({
chunks: ["main-page"],
template: "src/index.hbs",
}),
],
};
【问题讨论】:
标签: webpack webpack-dev-server