-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Library
React Components / v9 (@fluentui/react-components)
Are you reporting Accessibility issue?
None
Reproduction
Pre swc (using TS):
- esm map: https://unpkg.com/@fluentui/react-text@9.3.1/lib/Body1.js.map
- cjs map: https://unpkg.com/@fluentui/react-text@9.3.1/lib-commonjs/Body1.js.map
- cjs: https://unpkg.com/@fluentui/react-text@9.3.1/lib-commonjs/Body1.js
Post swc:
-
esm map: https://unpkg.com/@fluentui/react-text@9.3.2/lib/Body1.js.map
-
cjs map: https://unpkg.com/@fluentui/react-text@9.3.2/lib-commonjs/Body1.js.map
-
cjs: https://unpkg.com/@fluentui/react-text@9.3.2/lib-commonjs/Body1.js
Bug Description
Actual Behavior
After migration to swc, source maps for commonjs inputs don't point to TS original source anymore.
Also the sourceMappingURL is being printed twice within cjs output (which is present within the source map )
Expected Behavior
This regression is actually expected, but we didn't thought about it while implementing the change, as our transpilation pipeline changed
From
graph LR;
S["Start"]
E["End"]
B["Babel"]
S-->TSC:esm-->B
S-->TSC:cjs-->B
B-->E;
To
graph LR;
S["Start"]
E["End"]
B["Babel"]
S-->SWC:esm-->B-->SWC:cjs-->E
Besides the duplicated sourceMappingURL emit within cjs output, it shouldn't have any real impact for consumers, as we use sourcesContent which is a source of truth for the actual source mapping.
More feedback is needed.
Actionable for now is to reduce that duplicate emit for commonjs.
Logs
No response
Requested priority
Normal
Products/sites affected
No response
Are you willing to submit a PR to fix?
yes
Validations
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.

