fix(node): disable name mangling when building for production
disable name mangling when building for production with optimization on, in order not to break features relying on runtime reflection ISSUES CLOSED: #8537
This commit is contained in:
parent
56aed61b49
commit
50baf92fc9
@ -51,6 +51,7 @@
|
|||||||
"webpack": "^5.58.1",
|
"webpack": "^5.58.1",
|
||||||
"webpack-merge": "^5.8.0",
|
"webpack-merge": "^5.8.0",
|
||||||
"webpack-node-externals": "^3.0.0",
|
"webpack-node-externals": "^3.0.0",
|
||||||
|
"terser-webpack-plugin": "^5.1.1",
|
||||||
"rxjs-for-await": "0.0.2",
|
"rxjs-for-await": "0.0.2",
|
||||||
"ts-node": "~9.1.1"
|
"ts-node": "~9.1.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,6 +53,7 @@ describe('getNodePartial', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(result.optimization.minimize).toEqual(true);
|
expect(result.optimization.minimize).toEqual(true);
|
||||||
|
expect(result.optimization.minimizer).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should concatenate modules', () => {
|
it('should concatenate modules', () => {
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { merge } from 'webpack-merge';
|
|||||||
import { getBaseWebpackPartial } from './config';
|
import { getBaseWebpackPartial } from './config';
|
||||||
import { BuildNodeBuilderOptions } from './types';
|
import { BuildNodeBuilderOptions } from './types';
|
||||||
import nodeExternals = require('webpack-node-externals');
|
import nodeExternals = require('webpack-node-externals');
|
||||||
|
import TerserPlugin = require('terser-webpack-plugin');
|
||||||
|
|
||||||
function getNodePartial(options: BuildNodeBuilderOptions) {
|
function getNodePartial(options: BuildNodeBuilderOptions) {
|
||||||
const webpackConfig: Configuration = {
|
const webpackConfig: Configuration = {
|
||||||
@ -18,6 +19,13 @@ function getNodePartial(options: BuildNodeBuilderOptions) {
|
|||||||
if (options.optimization) {
|
if (options.optimization) {
|
||||||
webpackConfig.optimization = {
|
webpackConfig.optimization = {
|
||||||
minimize: true,
|
minimize: true,
|
||||||
|
minimizer: [
|
||||||
|
new TerserPlugin({
|
||||||
|
terserOptions: {
|
||||||
|
mangle: false,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
concatenateModules: true,
|
concatenateModules: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user