swc-project
swc
Blog
Docs
Changelog
Blog
Docs
Changelog
Overview
Branches
Benchmarks
Runs
Performance History
Latest Results
fix(flow): restore original TS module context behavior in non-flow mode
oblador:flow-strip-type-only-export
15 hours ago
perf(ecma_parser): gate ts accessor signature backtracking
kdy1/oxc-parser-rewrite
17 hours ago
feat(es): Add `jsc.preserveSymlinks` to `swc::Options` (#11813) ## Description Wires the `NodeImportResolver::with_config_preserving_symlinks` constructor (added in #11801) through to `swc::Options` as a new `jsc.preserveSymlinks` boolean config option. When enabled: - `ModuleConfig::get_resolver` skips the `base.canonicalize()` call on the input file, so the input path is left at its symlink location. - `build_resolver` constructs the `NodeImportResolver` via the new preserve-symlinks constructor, so rewritten module specifiers don't re-canonicalize target paths. - The `build_resolver` memoization key is extended with `preserve_symlinks` so the two modes don't share cached resolver instances. Default behaviour is unchanged — canonicalization still happens unless the flag is explicitly set. ## Motivation Monorepos that symlink shared source files (e.g. `shared/foo.ts` symlinked into `packages/app-a/src/foo.ts` and `packages/app-b/src/foo.ts`) break under the current behaviour: once any link is followed to the real path, relative imports inside `shared/` resolve against the real parent directory rather than the importing package, producing module-not-found errors. `resolve.symlinks: false` at the bundler level (rspack, webpack) is not enough if the downstream transformer re-canonicalizes. This PR is the upstream companion to web-infra-dev/rspack#13762, which exposes a `preserveSymlinks` option on `builtin:swc-loader` once this lands. ## Test `crates/swc/tests/preserve_symlinks.rs` (new) exercises the full `swc::Options` pipeline against a tempdir with the shape: ``` root/ src/index.ts // import "../server/source"; shared/source.ts // export const value = 1; server/source.ts // symlink -> ../shared/source.ts ``` It asserts that: - With `jsc.preserveSymlinks = false` (default): the rewritten specifier is `"../shared/source"` (canonicalized). - With `jsc.preserveSymlinks = true`: the rewritten specifier remains `"../server/source"` (symlink preserved). The existing low-level coverage in `crates/swc_ecma_transforms_module/tests/path_node.rs::symlink_paths_are_preserved_only_when_opted_in` is unchanged. ## Related issue: Closes #11584
main
21 hours ago
Update cool-lanterns-preserve.md
perbergland:feat/preserve-symlinks
21 hours ago
feat(es): Add `jsc.preserveSymlinks` to swc::Options (#11584) Wires `NodeImportResolver::with_config_preserving_symlinks` (added in #11801) through `swc::Options` as a new `jsc.preserveSymlinks` boolean. When enabled: - `ModuleConfig::get_resolver` skips `base.canonicalize()` on the input file so the input path is left at its symlink location. - `build_resolver` constructs `NodeImportResolver` via the preserve-symlinks constructor, so rewritten module specifiers do not re-canonicalize targets. - The `build_resolver` cache key is extended with `preserve_symlinks` so the two modes don't share resolver instances. Default behaviour is unchanged — canonicalization still happens unless the flag is explicitly set. Motivation: monorepos that symlink shared sources into per-package src directories (e.g. `shared/foo.ts` symlinked as `packages/app/src/foo.ts`) break under the current behaviour: once any symlink is followed to the real path, relative imports inside the shared file resolve against the real parent directory instead of the importing package, producing module-not-found errors in downstream bundlers. `resolve.symlinks: false` at the bundler level is insufficient while the swc resolver re-canonicalizes. Test: crates/swc/tests/preserve_symlinks.rs exercises the full swc::Options pipeline against a tempdir with a symlinked source file and asserts that the rewritten specifier preserves the symlink when `preserveSymlinks: true` and canonicalizes otherwise. Closes: rspack-side blocker for web-infra-dev/rspack#13762. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
perbergland:feat/preserve-symlinks
22 hours ago
perf(ecma_parser): avoid modifier checkpoint churn
kdy1/oxc-parser-rewrite
22 hours ago
test(swc_es_parser): add issue 11550 snapshot
kdy1/oxc-parser-rewrite
23 hours ago
test(swc_es_parser): add raw arrow jsx snapshot
kdy1/oxc-parser-rewrite
23 hours ago
Latest Branches
CodSpeed Performance Gauge
0%
Omit empty `export {}` when flow module has only type exports
#11809
16 hours ago
366921b
oblador:flow-strip-type-only-export
CodSpeed Performance Gauge
0%
perf(ecma_parser): start oxc-style token payload rewrite
#11812
17 hours ago
5439aaf
kdy1/oxc-parser-rewrite
CodSpeed Performance Gauge
0%
feat(es): Add `jsc.preserveSymlinks` to `swc::Options`
#11813
22 hours ago
86e0f7f
perbergland:feat/preserve-symlinks
© 2026 CodSpeed Technology
Home
Terms
Privacy
Docs