Answer the question
In order to leave comments, you need to log in
How to use webpack in production?
Hello, I'm a little confused with webpack. I am using webpack-dev-middleware:
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');
const compiler = webpack(webpackConfig);
app.use(webpackDevMiddleware(compiler,{
stats:{
colors: true,
hash: false,
timings: true,
chunks: false,
chunkModules: false,
modules: false
}
}));
app.use(webpackHotMiddleware(compiler));
Answer the question
In order to leave comments, you need to log in
In production, you need a scripts and styles file.
Therefore, you call webpack -p
(minus p tells webpack: generate a real bundle.js file and what else you specify) and put the finished file (s) on your server / hosting, etc. There is already at least apache, at least nginx, at least anything distributing statics.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question