webpack: Introduce webpack.dev-asset.json.

This commit will now allow development-only pages to
use development-only packages without breaking the
production build.
This commit is contained in:
Riken Shah
2021-04-15 20:57:23 +00:00
committed by Tim Abbott
parent c3601d7e3e
commit 14b01343d9
5 changed files with 40 additions and 26 deletions

View File

@@ -11,6 +11,7 @@ import BundleTracker from "webpack-bundle-tracker";
import DebugRequirePlugin from "./tools/debug-require-webpack-plugin";
import assets from "./tools/webpack.assets.json";
import dev_assets from "./tools/webpack.dev-assets.json";
const cacheLoader: webpack.RuleSetUseItem = {
loader: "cache-loader",
@@ -29,7 +30,7 @@ export default (_env: unknown, argv: {mode?: string}): webpack.Configuration[] =
entry: production
? assets
: Object.fromEntries(
Object.entries(assets).map(([name, paths]) => [
Object.entries({...assets, ...dev_assets}).map(([name, paths]) => [
name,
[...paths, "./static/js/debug"],
]),