Skip to content

Commit

Permalink
Use SWC
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Oct 2, 2024
1 parent d436dc4 commit b14d465
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 14 deletions.
85 changes: 73 additions & 12 deletions packages/@glimmer-workspace/build/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,87 @@ export function typescript(pkg, config) {
},
};

/** @type {[string, object][]} */
const presets = [['@babel/preset-typescript', { allowDeclareFields: true }]];

const ts = tsconfig(typeScriptConfig);

/**
* TODO: migrate off of rollupTS, it has too many bugs
*/
return rollupTS({
transpiler: 'babel',
transpiler: 'swc',
transpileOnly: true,
babelConfig: {
presets,
plugins: [require.resolve('@glimmer/local-debug-babel-plugin')],
swcConfig: {
jsc: {
parser: {
syntax: 'typescript',
tsx: false,
},
target: 'es2022',
loose: false,
minify: {
compress: {
arguments: false,
arrows: true,
booleans: true,
booleans_as_integers: false,
collapse_vars: true,
comparisons: true,
computed_props: true,
conditionals: true,
dead_code: true,
directives: true,
drop_console: false,
drop_debugger: true,
evaluate: true,
expression: false,
hoist_funs: false,
hoist_props: true,
hoist_vars: false,
if_return: true,
join_vars: true,
keep_classnames: false,
keep_fargs: true,
keep_fnames: false,
keep_infinity: false,
loops: true,
negate_iife: true,
properties: true,
reduce_funcs: false,
reduce_vars: false,
side_effects: true,
switches: true,
typeofs: true,
unsafe: false,
unsafe_arrows: false,
unsafe_comps: false,
unsafe_Function: false,
unsafe_math: false,
unsafe_symbols: false,
unsafe_methods: false,
unsafe_proto: false,
unsafe_regexp: false,
unsafe_undefined: false,
unused: true,
const_to_let: true,
pristine_globals: true,
},
mangle: false,
},
transform: {
constModules: {
globals: {
debug: {
'import.meta.env.VM_LOCAL_DEV': 'false',
},
},
},
},
},
module: {
type: 'es6',
},
minify: false,
isModule: true,
},
/**
* This shouldn't be required, but it is.
* If we use @rollup/plugin-babel, we can remove this.
*/
browserslist: [`last 1 chrome versions`],
tsconfig: ts,
});
}
Expand Down
2 changes: 2 additions & 0 deletions packages/@glimmer-workspace/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-replace": "^5.0.5",
"@rollup/plugin-terser": "^0.4.4",
"@swc/core": "^1.7.26",
"@swc/helpers": "^0.5.13",
"eslint": "^8.52.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-json": "^3.1.0",
Expand Down
144 changes: 142 additions & 2 deletions pnpm-lock.yaml

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

0 comments on commit b14d465

Please sign in to comment.