-
-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[commonjs] strictRequires indent with \t modifies multi-line string values. #1228
Comments
Actually considering that the plugin is already parsing the entire code and knows all template literals, the fix is to pass an |
As a workaround for now, I'm flattening multi-line strings with:
|
Expected Behavior
Multiline-string values should be preserved.
Actual Behavior
Indent
\t
characters are blindly inserted into the multi-line string.Additional Information
This particular issue seems to be due to:
plugins/packages/commonjs/src/transform-commonjs.js
Line 534 in add3a35
but there are other uses of
magicString.indent("\t")
in the code-base, e.g.:plugins/packages/commonjs/src/generate-exports.js
Lines 12 to 16 in add3a35
The simple fix is just don't indent code - I doubt it would be simple to implement a correct source-map-preserving indent. Perhaps instead doing a transform from multi-line template strings to single-line escape codes would also work?
The text was updated successfully, but these errors were encountered: