feat: support named exports with any characters #1057
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A proposed change to
css-loader
will allow named exports to be any string, regardless of whether or not it is a valid identifier. The code generation in this project assumes that all exports will be a valid identifier, so the generation stage has been updated to take this into account.This PR contains a:
Motivation / Use-Case
When using the new "asIs" named exports feature I submitted in webpack-contrib/css-loader#1549, this module will produce incorrect output since the export names may not be valid local identifiers.
Breaking Changes
Requires support for
export { local as "string literal" }
syntax which is not supported until nodejs v16.x.Additional Info
Named exports resolve the Terser bailout condition described in webpack/webpack#17626 but reduce "grepability" of your code.