1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-22 11:45:59 +01:00

Define Angular CLI globals to support tree shaking (#1408)

This commit is contained in:
Oscar Hinton 2022-03-22 10:09:19 +01:00 committed by GitHub
parent 09d7376f39
commit 37e9523f00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,6 +4,9 @@ const { merge } = require("webpack-merge");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { AngularWebpackPlugin } = require("@ngtools/webpack");
const TerserPlugin = require("terser-webpack-plugin");
const NODE_ENV = process.env.NODE_ENV == null ? "development" : process.env.NODE_ENV;
const common = {
module: {
@ -39,7 +42,7 @@ const common = {
const renderer = {
mode: "production",
devtool: false,
devtool: "source-map",
target: "electron-renderer",
node: {
__dirname: false,
@ -48,7 +51,19 @@ const renderer = {
"app/main": "./src/app/main.ts",
},
optimization: {
minimize: false,
minimizer: [
new TerserPlugin({
terserOptions: {
// Replicate Angular CLI behaviour
compress: {
global_defs: {
ngDevMode: false,
ngI18nClosureMode: false,
},
},
},
}),
],
splitChunks: {
cacheGroups: {
commons: {