Skip to content

Commit 7cdc173

Browse files
authored
feat: support source phase import for WebAssembly modules (#20364)
1 parent 0b60f1c commit 7cdc173

73 files changed

Lines changed: 1848 additions & 73 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/smooth-coats-laugh.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"webpack": minor
3+
---
4+
5+
Added `source` support for async WASM modules.

declarations/WebpackOptions.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,6 +1547,10 @@ export interface RuleSetRule {
15471547
parser?: {
15481548
[k: string]: any;
15491549
};
1550+
/**
1551+
* Match the import phase of the dependency.
1552+
*/
1553+
phase?: RuleSetConditionOrConditions;
15501554
/**
15511555
* Match the real resource path of the module.
15521556
*/
@@ -3386,6 +3390,10 @@ export interface JavascriptParserOptions {
33863390
* Enable/disable parsing of require.js special syntax like require.config, requirejs.config, require.version and requirejs.onError.
33873391
*/
33883392
requireJs?: boolean;
3393+
/**
3394+
* Enable experimental tc39 proposal https://github.com/tc39/proposal-source-phase-imports. This allows importing modules at source phase.
3395+
*/
3396+
sourceImport?: boolean;
33893397
/**
33903398
* @deprecated
33913399
* Deprecated in favor of "exportsPresence". Emit errors instead of warnings when imported names don't exist in imported module.
@@ -4025,6 +4033,10 @@ export interface ExperimentsExtra {
40254033
* Compile entrypoints and import()s only when they are accessed.
40264034
*/
40274035
lazyCompilation?: boolean | LazyCompilationOptions;
4036+
/**
4037+
* Enable experimental tc39 proposal https://github.com/tc39/proposal-source-phase-imports. This allows importing modules at source phase.
4038+
*/
4039+
sourceImport?: boolean;
40284040
[k: string]: any;
40294041
}
40304042
/**
@@ -4047,6 +4059,10 @@ export interface ExperimentsNormalizedExtra {
40474059
* Compile entrypoints and import()s only when they are accessed.
40484060
*/
40494061
lazyCompilation?: false | LazyCompilationOptions;
4062+
/**
4063+
* Enable experimental tc39 proposal https://github.com/tc39/proposal-source-phase-imports. This allows importing modules at source phase.
4064+
*/
4065+
sourceImport?: boolean;
40504066
}
40514067
/**
40524068
* If an dependency matches exactly a property of the object, the property value is used as dependency.

0 commit comments

Comments
 (0)