Skip to content

Commit 93f9d43

Browse files
Merge pull request #743 from lukecotter/chore-rolldown-native-minify
chore: use rolldown native minification and bump to rc.8
2 parents 8a05d59 + deb38a7 commit 93f9d43

3 files changed

Lines changed: 75 additions & 87 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"lint-staged": "^16.3.2",
2323
"prettier": "^3.8.1",
2424
"prettier-plugin-organize-imports": "^4.3.0",
25-
"rolldown": "1.0.0-rc.7",
25+
"rolldown": "1.0.0-rc.8",
2626
"rollup": "^4.59.0",
2727
"rollup-plugin-copy": "^3.5.0",
2828
"rollup-plugin-polyfill-node": "^0.13.0",

pnpm-lock.yaml

Lines changed: 69 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rolldown.config.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,13 @@ import nodePolyfills from '@rolldown/plugin-node-polyfills';
66
// rollup plugins
77
import copy from 'rollup-plugin-copy';
88
import postcss from 'rollup-plugin-postcss';
9-
import { defineRollupSwcOption, swc } from 'rollup-plugin-swc3';
109

1110
import path from 'path';
1211
import { fileURLToPath } from 'url';
1312

1413
const __filename = fileURLToPath(import.meta.url);
1514
const __dirname = path.dirname(__filename);
1615

17-
const getSwcOptions = (dirPath: string) =>
18-
defineRollupSwcOption({
19-
include: /\.[mc]?[jt]sx?$/,
20-
exclude: 'node_modules',
21-
tsconfig: production ? `${dirPath}/tsconfig.json` : `${dirPath}/tsconfig-dev.json`,
22-
jsc: {
23-
transform: { useDefineForClassFields: false },
24-
minify: {
25-
compress: production ? { keep_classnames: true, keep_fnames: true } : false,
26-
mangle: production ? { keep_classnames: true } : false,
27-
},
28-
},
29-
});
30-
3116
/**
3217
* Workaround for oxc printer lone-surrogate bug (https://github.com/oxc-project/oxc/issues/3526).
3318
* The oxc codegen replaces lone surrogates (0xD800-0xDFFF) with U+FFFD in long CJS strings,
@@ -63,9 +48,11 @@ export default defineConfig([
6348
output: {
6449
format: 'esm',
6550
dir: './lana/out',
51+
cleanDir: true,
6652
chunkFileNames: 'lana-[name].js',
6753
sourcemap: false,
6854
keepNames: true,
55+
minify: production,
6956
},
7057
tsconfig: production ? './lana/tsconfig.json' : './lana/tsconfig-dev.json',
7158
platform: 'node',
@@ -76,17 +63,19 @@ export default defineConfig([
7663
},
7764

7865
external: ['vscode'],
79-
plugins: [preserveAntlrATN(), swc(getSwcOptions('./lana'))],
66+
plugins: [preserveAntlrATN()],
8067
},
8168
{
8269
input: { bundle: './log-viewer/src/Main.ts' },
8370
output: [
8471
{
8572
format: 'esm',
8673
dir: './log-viewer/out',
74+
cleanDir: true,
8775
chunkFileNames: 'log-viewer-[name].js',
8876
sourcemap: false,
8977
keepNames: true,
78+
minify: production,
9079
},
9180
],
9281
platform: 'browser',
@@ -103,7 +92,6 @@ export default defineConfig([
10392
extensions: ['.css', '.scss'],
10493
minimize: true,
10594
}),
106-
swc(getSwcOptions('./log-viewer')),
10795
copy({
10896
hook: 'closeBundle',
10997
targets: [

0 commit comments

Comments
 (0)