Skip to content

Commit

Permalink
🧱 🚨 chore: update npm dependencies and add terser plugin for rollup.c…
Browse files Browse the repository at this point in the history
…onfig.js files
  • Loading branch information
aiyoudiao committed Aug 25, 2024
1 parent d82363f commit 816cbe7
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 18 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@nx/rollup": "19.6.2",
"@nx/vite": "19.6.2",
"@nx/web": "19.6.2",
"@rollup/plugin-terser": "^0.4.4",
"@swc-node/register": "~1.9.1",
"@swc/cli": "~0.3.12",
"@swc/core": "~1.5.7",
Expand Down
20 changes: 20 additions & 0 deletions packages/i18n-en/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { withNx } = require('@nx/rollup/with-nx');
const terser = require('@rollup/plugin-terser');

module.exports = withNx(
{
Expand All @@ -13,5 +14,24 @@ module.exports = withNx(
// Provide additional rollup configuration here. See: https://rollupjs.org/configuration-options
// e.g.
output: { name: 'i18nEn', sourcemap: true, extend: true },
plugins: [
terser({
format: {
comments: false,
},
compress: {
drop_console: true,
passes: 3, // 多次压缩,提高效果
hoist_funs: true, // 提升函数声明
reduce_vars: true, // 减少变量使用
collapse_vars: true, // 合并变量
},
mangle: {
properties: {
regex: /^_/, // 选择性的混淆变量名(以_开头的变量名)
},
},
}),
],
}
);
20 changes: 20 additions & 0 deletions packages/i18n-zh/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { withNx } = require('@nx/rollup/with-nx');
const terser = require('@rollup/plugin-terser');

module.exports = withNx(
{
Expand All @@ -13,5 +14,24 @@ module.exports = withNx(
// Provide additional rollup configuration here. See: https://rollupjs.org/configuration-options
// e.g.
output: { name: 'i18nZh', sourcemap: true, extend: true },
plugins: [
terser({
format: {
comments: false,
},
compress: {
drop_console: true,
passes: 3, // 多次压缩,提高效果
hoist_funs: true, // 提升函数声明
reduce_vars: true, // 减少变量使用
collapse_vars: true, // 合并变量
},
mangle: {
properties: {
regex: /^_/, // 选择性的混淆变量名(以_开头的变量名)
},
},
}),
],
}
);
20 changes: 20 additions & 0 deletions packages/i18n/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { withNx } = require('@nx/rollup/with-nx');
const terser = require('@rollup/plugin-terser');

module.exports = withNx(
{
Expand All @@ -13,5 +14,24 @@ module.exports = withNx(
// Provide additional rollup configuration here. See: https://rollupjs.org/configuration-options
// e.g.
output: { name: 'i18n', sourcemap: true, extend: true },
plugins: [
terser({
format: {
comments: false,
},
compress: {
drop_console: true,
passes: 3, // 多次压缩,提高效果
hoist_funs: true, // 提升函数声明
reduce_vars: true, // 减少变量使用
collapse_vars: true, // 合并变量
},
mangle: {
properties: {
regex: /^_/, // 选择性的混淆变量名(以_开头的变量名)
},
},
}),
],
}
);
42 changes: 25 additions & 17 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SCRIPT_DIR=$(cd $(dirname $0); pwd)

# 遍历指定的项目
for project in "${projects[@]}"; do
PROJECT_DIR="$SCRIPT_DIR/packages/$project"
PROJECT_DIR="$SCRIPT_DIR/dist/packages/$project"
PACKAGE_JSON="$PROJECT_DIR/package.json"

# 检查 package.json 文件是否存在
Expand Down

0 comments on commit 816cbe7

Please sign in to comment.