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.
Copy file name to clipboardExpand all lines: src/content/configuration/index.mdx
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -22,15 +22,17 @@ contributors:
22
22
23
23
Out of the box, webpack won't require you to use a configuration file. However, it will assume the entry point of your project is `src/index.js` and will output the result in `dist/main.js` minified and optimized for production.
24
24
25
+
T> [createapp.dev](https://createapp.dev/webpack) is an online tool for creating custom webpack configuration. It allows you to select various features that will be combined and added to resulting configuration file. Also, it generates an example project based on provided webpack configuration that you can review in your browser and download.
26
+
25
27
Usually your projects will need to extend this functionality, for this you can create a `webpack.config.js` file in the root folder and webpack will automatically use it.
26
28
27
29
All the available configuration options are specified below.
28
30
29
31
T> New to webpack? Check out our guide to some of webpack's [core concepts](/concepts) to get started!
30
32
31
-
## Use different configuration file
33
+
## Use a different configuration file
32
34
33
-
If for some reason you want to use different configuration file depending on certain situations you can change this via command line by using the `--config` flag.
35
+
If for some reason you want to use different configuration file depending on certain situations, you can change this via command line by using the `--config` flag.
34
36
35
37
**package.json**
36
38
@@ -1170,4 +1172,4 @@ found 0 vulnerabilities
1170
1172
Congratulations! Your new webpack configuration file has been created!
1171
1173
```
1172
1174
1173
-
[createapp.dev - create a webpack configuration in your browser](https://createapp.dev/webpack) is an online tool for creating custom webpack configuration. It allows you to select various features that will be combined and added to resulting configuration file. Also, it generates an example project based on provided webpack configuration that you can review in your browser and download.
0 commit comments