-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(turbopack-ecmascript): Add implementation for webpackIgnore and …
…turbopackIgnore (revision of #69113) (#69768) ## History @arlyon was working on this in #69113. He's out of office, and this is a feature we want to get landed soon, so I was seeing what needed to happen to get it to merge. I encountered more issues, and I didn't feel entirely comfortable pushing deep changes to @arlyon's branch, so this builds on top of his (rebased) commit. This is my attempted PR to fix these problems. ## What? *Copied from #69113's description.* Certain bundles may be designed specifically to be included at runtime. To support this usecase, webpack implemented a comment directive `webpackIgnore` that opted out that particular import from bundle time optimisations. We need to support this, as some libraries take advantage of this (mapbox). Closes PACK-3046 ## Changes from #69113 - Bail out much earlier in the analysis. The other PR appeared to bail out too late, and would generate a `Promise.resolve()` call, instead of preserving `import`/`require`. My understanding of webpack's feature is that it should include the `import`/`require`. - Skip "too dynamic" analysis for ignored imports. - Switch to a snapshot test, so that we can verify that the output actually contains the `import`/`require` expressions. - Integrates my changes from #69755 to use an `ImportOverrides` struct instead of a bool. --------- Co-authored-by: Alexander Lyon <arlyon@me.com> Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
- Loading branch information
1 parent
6599b32
commit 935460c
Showing
21 changed files
with
300 additions
and
125 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Oops, something went wrong.