Answer the question
In order to leave comments, you need to log in
Why doesn't webpack update JS when it changes?
I don’t understand why it doesn’t update ...
I need to combine both JS and CSS files, I do everything like this
const path = require('path')
, MiniCssExtractPlugin = require("mini-css-extract-plugin")
module.exports = {
entry: ["./bundle.js", "./bundle.css"],
target: "web",
module: {
rules: [
{ test: /\.(js)$/, use: ['babel-loader'] },
{ test: /\.css$/, use: [ MiniCssExtractPlugin.loader, 'css-loader' ] }
]
},
output: {
path: path.resolve(__dirname, '/static/assets'),
publicPath: '/static/assets/',
filename: "bindle.min.js",
},
mode: "production",
devtool: "source-map",
devServer: {
hot: true,
static: {
directory: path.join(__dirname, '/static')
},
allowedHosts: 'all',
compress: true,
port: 9000,
},
plugins: [
new MiniCssExtractPlugin({
filename: "bindle.min.css",
})
]
}
....
"scripts": {
"build": "NODE_ENV=production webpack",
"dev": "webpack-dev-server --hot"
}....
"webpack": "^5.60.0",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.4.0"
....
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question