mirror of
https://github.com/FormidableLabs/webpack-dashboard.git
synced 2026-01-25 14:27:01 +00:00
- Add webpack5 support. Fixes #316 - Bugfix: Webpack 5 warning message conflict. Fixes #314 - Fix bugs in updated `commander` integration.
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
const { resolve } = require("path");
|
|
const { StatsWriterPlugin } = require("webpack-stats-plugin");
|
|
const { DuplicatesPlugin } = require("inspectpack/plugin");
|
|
const Dashboard = require("../../plugin");
|
|
const webpackPkg = require("webpack/package.json");
|
|
const webpackVers = webpackPkg.version.split(".")[0];
|
|
|
|
// Specify the directory of the example we're working with
|
|
const cwd = `${process.cwd()}/examples/${process.env.EXAMPLE}`;
|
|
if (!process.env.EXAMPLE) {
|
|
throw new Error("EXAMPLE is required");
|
|
}
|
|
|
|
const mode = process.env.WEBPACK_MODE || "development";
|
|
|
|
module.exports = {
|
|
mode,
|
|
devtool: false,
|
|
context: resolve(cwd),
|
|
entry: {
|
|
bundle: "./src/index.js",
|
|
// Hard-code path to the "hello world" no-dep entry for 2+ asset testing
|
|
hello: "../simple/src/index.js"
|
|
},
|
|
output: {
|
|
path: resolve(cwd, `dist-${mode}-${webpackVers}`),
|
|
pathinfo: true,
|
|
filename: "[name].js"
|
|
},
|
|
plugins: [
|
|
new StatsWriterPlugin({
|
|
fields: ["assets", "modules"],
|
|
stats: {
|
|
source: true // Needed for webpack5+
|
|
}
|
|
}),
|
|
new DuplicatesPlugin({
|
|
verbose: true,
|
|
emitErrors: false
|
|
}),
|
|
new Dashboard({
|
|
// Optionally filter which assets to report on by string prefix or regex.
|
|
// includeAssets: ["bundle", /bund/]
|
|
})
|
|
]
|
|
};
|