You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/configuration/experiments.mdx
+89-4Lines changed: 89 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ contributors:
8
8
- anshumanv
9
9
---
10
10
11
-
## `experiments`
11
+
## experiments
12
12
13
13
`boolean: false`
14
14
@@ -19,6 +19,7 @@ W> Because experimental features have relaxed semantic versioning and might cont
19
19
Available options:
20
20
21
21
-`asyncWebAssembly`: Support the new WebAssembly according to the [updated specification](https://github.com/WebAssembly/esm-integration), it makes a WebAssembly module an async module.
22
+
-[`buildHttp`](#experimentsbuildhttp)
22
23
-[`executeModule`](#experimentsexecutemodule)
23
24
-`layers`: Enable module and chunk layers.
24
25
-[`lazyCompilation`](#experimentslazycompilation)
@@ -32,17 +33,101 @@ Available options:
32
33
module.exports= {
33
34
//...
34
35
experiments: {
36
+
asyncWebAssembly:true,
37
+
buildHttp:true,
35
38
executeModule:true,
39
+
layers:true,
40
+
lazyCompilation:true,
36
41
outputModule:true,
37
42
syncWebAssembly:true,
38
43
topLevelAwait:true,
39
-
asyncWebAssembly:true,
40
-
layers:true,
41
-
lazyCompilation:true,
42
44
},
43
45
};
44
46
```
45
47
48
+
### experiments.buildHttp
49
+
50
+
When enabled, webpack can build remote resources that begin with the `http(s):` protocol.
51
+
52
+
- Type:
53
+
54
+
One of the following:
55
+
56
+
-`boolean`
57
+
-`HttpUriOptions`
58
+
```ts
59
+
{
60
+
cacheLocation?:false|string,
61
+
frozen?:boolean,
62
+
lockfileLocation?:string,
63
+
upgrade?:boolean
64
+
}
65
+
```
66
+
67
+
- Available: 5.49.0+
68
+
- Example
69
+
70
+
```javascript
71
+
// webpack.config.js
72
+
module.exports= {
73
+
//...
74
+
experiments: {
75
+
buildHttp:true,
76
+
},
77
+
};
78
+
```
79
+
80
+
```js
81
+
// src/index.js
82
+
importpMap1from'https://cdn.skypack.dev/p-map';
83
+
// with `buildHttp` enabled, webpack will build pMap1 just like a regular local module
84
+
console.log(pMap1);
85
+
```
86
+
87
+
#### experiments.buildHttp.cacheLocation
88
+
89
+
Define the location for caching remote resources.
90
+
91
+
- Type
92
+
-`string`
93
+
-`false`
94
+
- Example
95
+
```javascript
96
+
// webpack.config.js
97
+
module.exports= {
98
+
//...
99
+
experiments: {
100
+
buildHttp: {
101
+
cacheLocation:false,
102
+
},
103
+
},
104
+
};
105
+
```
106
+
107
+
By default webpack would use `<compiler-name.>webpack.lock.data/` for caching, but you can disable it by setting its value to `false`.
108
+
109
+
Note that you should commit files under `experiments.buildHttp.cacheLocation` into a version control system as no network requests will be made during the `production` build.
110
+
111
+
#### experiments.buildHttp.frozen
112
+
113
+
Freeze the remote resources and lockfile. Any modification to the lockfile or resource contents will result in an error.
114
+
115
+
- Type: `boolean`
116
+
117
+
#### experiments.buildHttp.lockfileLocation
118
+
119
+
Define the location to store the lockfile.
120
+
121
+
- Type: `string`
122
+
123
+
By default webpack would generate a `<compiler-name.>webpack.lock` file>. Make sure to commit it into a version control system. During the `production` build, webpack will build those modules beginning with `http(s):` protocol from the lockfile and caches under [`experiments.buildHttp.cacheLocation`](#experimentsbuildhttpcachelocation).
124
+
125
+
#### experiments.buildHttp.upgrade
126
+
127
+
Detect changes to remote resources and upgrade them automatically.
128
+
129
+
- Type: `boolean`
130
+
46
131
### experiments.executeModule
47
132
48
133
Enable execution of modules from the module graph for plugins and loaders at build time to generate code or other assets.
0 commit comments