mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-03 13:33:32 +01:00
Define Angular CLI globals to support tree shaking (#1408)
This commit is contained in:
parent
09d7376f39
commit
37e9523f00
@ -4,6 +4,9 @@ const { merge } = require("webpack-merge");
|
|||||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||||
const { AngularWebpackPlugin } = require("@ngtools/webpack");
|
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 = {
|
const common = {
|
||||||
module: {
|
module: {
|
||||||
@ -39,7 +42,7 @@ const common = {
|
|||||||
|
|
||||||
const renderer = {
|
const renderer = {
|
||||||
mode: "production",
|
mode: "production",
|
||||||
devtool: false,
|
devtool: "source-map",
|
||||||
target: "electron-renderer",
|
target: "electron-renderer",
|
||||||
node: {
|
node: {
|
||||||
__dirname: false,
|
__dirname: false,
|
||||||
@ -48,7 +51,19 @@ const renderer = {
|
|||||||
"app/main": "./src/app/main.ts",
|
"app/main": "./src/app/main.ts",
|
||||||
},
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
minimize: false,
|
minimizer: [
|
||||||
|
new TerserPlugin({
|
||||||
|
terserOptions: {
|
||||||
|
// Replicate Angular CLI behaviour
|
||||||
|
compress: {
|
||||||
|
global_defs: {
|
||||||
|
ngDevMode: false,
|
||||||
|
ngI18nClosureMode: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
splitChunks: {
|
splitChunks: {
|
||||||
cacheGroups: {
|
cacheGroups: {
|
||||||
commons: {
|
commons: {
|
||||||
|
Loading…
Reference in New Issue
Block a user