As we all know, you can run Webpack from the command line using the CLI by running,
webpack
Which reads the file webpack.config.js
and compiles your files accordingly.
Is it possible to do this same thing from within a file? In other words, is it possible to run Webpack without using the CLI?
Yes.
https://webpack.js.org/api/node/
const webpack = require("webpack");
webpack({
// Configuration Object
}, (err, stats) => {
if (err || stats.hasErrors()) {
// Handle errors here
}
// Done processing
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments