Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moment's dead code elimination #864

Merged
merged 2 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
const path = require("path");

const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { IgnorePlugin } = require('webpack');

module.exports = {
devtool: "source-map",
Expand All @@ -30,6 +31,10 @@ module.exports = {
},
plugins: [
new MiniCssExtractPlugin(),
new IgnorePlugin({
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/,
}),
],
module: {
rules: [
Expand Down
9 changes: 7 additions & 2 deletions config/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ const bundleAnalyzerConfig = {
]
}

const polyfillsConfig = {
entry: {
polyfills: "./src/client/polyfills.ts",
}
};

const prodConfig = {
name: "client-modern",
mode: "production",
entry: {
main: "./src/client/main.tsx",
polyfills: "./src/client/polyfills.ts",
},
optimization: {
minimize: true,
Expand Down Expand Up @@ -68,6 +73,6 @@ const es5Config = {
};

module.exports = [
merge.smart(commonConfig, prodConfig, bundleAnalyzerConfig),
merge.smart(commonConfig, prodConfig, polyfillsConfig, bundleAnalyzerConfig),
merge.smart(commonConfig, prodConfig, es5Config),
]