-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
feat(plugin-asset): support generator['asset'].importMode
for Rslib
#8724
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✅ Deploy Preview for rspack canceled.
|
github-actions
bot
added
the
release: feature
release: feature related release(mr only)
label
Dec 16, 2024
SoonIter
force-pushed
the
export-asset
branch
2 times, most recently
from
December 17, 2024 10:38
8453ef5
to
f481b0a
Compare
SoonIter
changed the title
feat: support export asset
feat(plugin-asset): support re-export and preserve-export in asset for Rslib
Dec 17, 2024
SoonIter
force-pushed
the
export-asset
branch
from
December 17, 2024 10:51
f481b0a
to
5aef05d
Compare
6 tasks
SoonIter
changed the title
feat(plugin-asset): support re-export and preserve-export in asset for Rslib
feat(plugin-asset): support re-export and preserve-import in asset for Rslib
Dec 18, 2024
!pkg.pr.new |
SoonIter
force-pushed
the
export-asset
branch
3 times, most recently
from
January 13, 2025 10:40
ad92af5
to
083d2d5
Compare
SoonIter
force-pushed
the
export-asset
branch
from
January 13, 2025 11:39
083d2d5
to
1235f70
Compare
SoonIter
changed the title
feat(plugin-asset): support re-export and preserve-import in asset for Rslib
feat(plugin-asset): support Jan 13, 2025
experimentalLibPreserveImport
in asset for Rslib
CodSpeed Performance ReportMerging #8724 will not alter performanceComparing Summary
|
SoonIter
force-pushed
the
export-asset
branch
2 times, most recently
from
January 14, 2025 12:56
ed51dea
to
c4e833d
Compare
SoonIter
changed the title
feat(plugin-asset): support
feat(plugin-asset): support Jan 15, 2025
experimentalLibPreserveImport
in asset for Rslibgenerator['asset'].experimentalLibPreserveImport
for Rslib
One drawback is that there may be some errors in the sourcemap, I have not tested it at present |
JSerFeng
reviewed
Jan 16, 2025
We need a more general name for this, this shouldn't be lib specific |
SoonIter
changed the title
feat(plugin-asset): support
feat(plugin-asset): support Jan 17, 2025
generator['asset'].experimentalLibPreserveImport
for Rslibgenerator['asset'].experimentalPreserveImport
for Rslib
LGTM @ahabhgk |
SoonIter
changed the title
feat(plugin-asset): support
feat(plugin-asset): support Jan 20, 2025
generator['asset'].experimentalPreserveImport
for Rslibgenerator['asset'].importMode
for Rslib
SoonIter
force-pushed
the
export-asset
branch
from
January 20, 2025 08:47
cf83ee1
to
a60837c
Compare
ahabhgk
approved these changes
Jan 20, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
for web-infra-dev/rslib#570 and associated with web-infra-dev/rslib#684
For mid-level artifacts such as libraries in ESM/CJS formats, import statements for assets can be preserved to allow the upper-level applications to handle them.
In Rslib, we provide an option for users to choose, this feature needs to be implemented in Rspack.
Details
this pr does these things below:
generator['asset/resource'].importMode
type: 'url' | 'preserve'
default: 'url'
When this option is turned on, we will keep the require or import statement for asset. (you can see the example below from Rslib or you can see the test-case)
input
└── src ├── assets │ └── logo.svg // <-- └── index.tsx
output
add
CodeGenerationPublicPathAutoReplace
togenerator_context.data
, it can mark the js modules need to do replacements ofAUTO_PUBLIC_PATH_PLACEHOLDER
, it has the similar logic withexperiments.css
[Feature]: Support
publicPath: auto
in asset module #8748fix webpack asset module bugs(different from webpack)
Related links
close #8711
partially support #8748
Checklist