update pay function
This commit is contained in:
@@ -39,6 +39,13 @@ module.exports = {
|
||||
priority: 30,
|
||||
reuseExistingChunk: true,
|
||||
},
|
||||
// TradingView Lightweight Charts 单独分离(避免被压缩破坏)
|
||||
lightweightCharts: {
|
||||
test: /[\\/]node_modules[\\/]lightweight-charts[\\/]/,
|
||||
name: 'lightweight-charts',
|
||||
priority: 26,
|
||||
reuseExistingChunk: true,
|
||||
},
|
||||
// 大型图表库分离(echarts, d3, apexcharts 等)
|
||||
charts: {
|
||||
test: /[\\/]node_modules[\\/](echarts|echarts-for-react|apexcharts|react-apexcharts|recharts|d3|d3-.*)[\\/]/,
|
||||
@@ -96,8 +103,31 @@ module.exports = {
|
||||
moduleIds: 'deterministic',
|
||||
// 最小化配置
|
||||
minimize: true,
|
||||
minimizer: [
|
||||
...webpackConfig.optimization.minimizer,
|
||||
],
|
||||
};
|
||||
|
||||
// 配置 Terser 插件,保留 lightweight-charts 的方法名
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
webpackConfig.optimization.minimizer = webpackConfig.optimization.minimizer.map(plugin => {
|
||||
if (plugin.constructor.name === 'TerserPlugin') {
|
||||
return new TerserPlugin({
|
||||
...plugin.options,
|
||||
terserOptions: {
|
||||
...plugin.options.terserOptions,
|
||||
keep_classnames: /^(IChartApi|ISeriesApi|Re)$/, // 保留 lightweight-charts 的类名
|
||||
keep_fnames: /^(createChart|addLineSeries|addSeries)$/, // 保留关键方法名
|
||||
mangle: {
|
||||
...plugin.options.terserOptions.mangle,
|
||||
reserved: ['createChart', 'addLineSeries', 'addSeries', 'IChartApi', 'ISeriesApi'],
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
return plugin;
|
||||
});
|
||||
|
||||
// 生产环境禁用 source map 以加快构建(可节省 40-60% 时间)
|
||||
webpackConfig.devtool = false;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user