@nx/webpack 24.0.0-beta.1 → 24.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/internal.d.ts +3 -0
- package/dist/internal.js +7 -1
- package/dist/src/executors/dev-server/dev-server.impl.js +38 -30
- package/dist/src/generators/configuration/configuration.js +14 -132
- package/dist/src/generators/configuration/schema.d.ts +0 -1
- package/dist/src/generators/convert-config-to-webpack-plugin/convert-config-to-webpack-plugin.js +82 -49
- package/dist/src/generators/convert-config-to-webpack-plugin/lib/extract-webpack-options.d.ts +1 -0
- package/dist/src/generators/convert-config-to-webpack-plugin/lib/extract-webpack-options.js +31 -2
- package/dist/src/generators/convert-config-to-webpack-plugin/schema.json +2 -2
- package/dist/src/generators/convert-to-inferred/convert-to-inferred.js +5 -4
- package/dist/src/generators/convert-to-inferred/utils/build-post-target-transformer.js +13 -5
- package/dist/src/generators/convert-to-inferred/utils/serve-post-target-transformer.js +8 -14
- package/dist/src/generators/init/init.js +45 -54
- package/dist/src/generators/init/schema.d.ts +0 -1
- package/dist/src/migrations/update-24-0-0/finish-inferred-conversion.md +11 -0
- package/dist/src/migrations/update-24-0-0/inventory.d.ts +9 -0
- package/dist/src/migrations/update-24-0-0/inventory.js +53 -0
- package/dist/src/migrations/update-24-0-0/migrate-compose-plugins.d.ts +10 -0
- package/dist/src/migrations/update-24-0-0/migrate-compose-plugins.js +60 -0
- package/dist/src/migrations/update-24-0-0/migrate-compose-plugins.md +98 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.d.ts +6 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.js +36 -0
- package/dist/src/migrations/update-24-0-0/remove-deprecated-executors.md +92 -0
- package/dist/src/plugins/nx-webpack-plugin/lib/normalize-options.d.ts +6 -0
- package/dist/src/plugins/nx-webpack-plugin/lib/normalize-options.js +29 -24
- package/dist/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin.js +12 -1
- package/dist/src/utils/config.d.ts +8 -12
- package/dist/src/utils/config.js +15 -68
- package/dist/src/utils/deprecation.d.ts +1 -6
- package/dist/src/utils/deprecation.js +4 -27
- package/dist/src/utils/e2e-web-server-info-utils.d.ts +1 -1
- package/dist/src/utils/e2e-web-server-info-utils.js +2 -2
- package/dist/src/utils/with-nx.d.ts +5 -9
- package/dist/src/utils/with-nx.js +5 -32
- package/dist/src/utils/with-web.d.ts +5 -9
- package/dist/src/utils/with-web.js +5 -24
- package/executors.json +0 -10
- package/migrations.json +13 -0
- package/package.json +4 -4
- package/dist/src/executors/webpack/lib/run-webpack.d.ts +0 -3
- package/dist/src/executors/webpack/lib/run-webpack.js +0 -36
- package/dist/src/executors/webpack/schema.json +0 -459
- package/dist/src/executors/webpack/webpack.impl.d.ts +0 -13
- package/dist/src/executors/webpack/webpack.impl.js +0 -117
- package/dist/src/utils/has-plugin.d.ts +0 -2
- package/dist/src/utils/has-plugin.js +0 -10
|
@@ -1,459 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 2,
|
|
3
|
-
"outputCapture": "direct-nodejs",
|
|
4
|
-
"title": "Webpack builder",
|
|
5
|
-
"description": "Build a project using webpack.",
|
|
6
|
-
"cli": "nx",
|
|
7
|
-
"type": "object",
|
|
8
|
-
"x-deprecated": "The `@nx/webpack:webpack` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/webpack:convert-to-inferred` to migrate to the `@nx/webpack/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
|
|
9
|
-
"properties": {
|
|
10
|
-
"crossOrigin": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"description": "The `crossorigin` attribute to use for generated javascript script tags. One of 'none' | 'anonymous' | 'use-credentials'."
|
|
13
|
-
},
|
|
14
|
-
"main": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "The name of the main entry-point file.",
|
|
17
|
-
"x-completion-type": "file",
|
|
18
|
-
"x-completion-glob": "**/*@(.js|.ts|.tsx)",
|
|
19
|
-
"x-priority": "important"
|
|
20
|
-
},
|
|
21
|
-
"tsConfig": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"description": "The name of the Typescript configuration file.",
|
|
24
|
-
"x-completion-type": "file",
|
|
25
|
-
"x-completion-glob": "tsconfig.*.json",
|
|
26
|
-
"x-priority": "important"
|
|
27
|
-
},
|
|
28
|
-
"compiler": {
|
|
29
|
-
"type": "string",
|
|
30
|
-
"description": "The compiler to use.",
|
|
31
|
-
"enum": ["babel", "swc", "tsc"]
|
|
32
|
-
},
|
|
33
|
-
"outputPath": {
|
|
34
|
-
"type": "string",
|
|
35
|
-
"description": "The output path of the generated files.",
|
|
36
|
-
"x-completion-type": "directory",
|
|
37
|
-
"x-priority": "important"
|
|
38
|
-
},
|
|
39
|
-
"target": {
|
|
40
|
-
"type": "string",
|
|
41
|
-
"alias": "platform",
|
|
42
|
-
"description": "Target platform for the build, same as the Webpack target option.",
|
|
43
|
-
"enum": ["node", "web", "webworker"]
|
|
44
|
-
},
|
|
45
|
-
"watch": {
|
|
46
|
-
"type": "boolean",
|
|
47
|
-
"description": "Enable re-building when files change."
|
|
48
|
-
},
|
|
49
|
-
"cache": {
|
|
50
|
-
"description": "Configure webpack caching behavior. When not specified, defaults to `{ type: 'memory' }` for Node targets in watch mode, and `undefined` otherwise.",
|
|
51
|
-
"oneOf": [
|
|
52
|
-
{
|
|
53
|
-
"type": "boolean"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"type": "object",
|
|
57
|
-
"properties": {
|
|
58
|
-
"type": {
|
|
59
|
-
"type": "string",
|
|
60
|
-
"description": "The type of cache to use.",
|
|
61
|
-
"enum": ["memory", "filesystem"]
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"additionalProperties": true
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
"baseHref": {
|
|
69
|
-
"type": "string",
|
|
70
|
-
"description": "Base url for the application being built."
|
|
71
|
-
},
|
|
72
|
-
"deployUrl": {
|
|
73
|
-
"type": "string",
|
|
74
|
-
"description": "URL where the application will be deployed."
|
|
75
|
-
},
|
|
76
|
-
"vendorChunk": {
|
|
77
|
-
"type": "boolean",
|
|
78
|
-
"description": "Use a separate bundle containing only vendor libraries."
|
|
79
|
-
},
|
|
80
|
-
"commonChunk": {
|
|
81
|
-
"type": "boolean",
|
|
82
|
-
"description": "Use a separate bundle containing code used across multiple bundles."
|
|
83
|
-
},
|
|
84
|
-
"runtimeChunk": {
|
|
85
|
-
"type": "boolean",
|
|
86
|
-
"description": "Use a separate bundle containing the runtime."
|
|
87
|
-
},
|
|
88
|
-
"skipTypeChecking": {
|
|
89
|
-
"alias": "typeCheck",
|
|
90
|
-
"type": "boolean",
|
|
91
|
-
"description": "Skip the type checking. Default is `false`.",
|
|
92
|
-
"x-deprecated": "Use `typeCheckOptions` instead. This option will be removed in Nx 24."
|
|
93
|
-
},
|
|
94
|
-
"typeCheckOptions": {
|
|
95
|
-
"description": "Configure type checking during the build. Set to `true` to enable with defaults (async: true). Set to `false` to disable type checking entirely. Use `{ async: true }` to run type checking in a separate process without blocking the build. Default is `{ async: true }`.",
|
|
96
|
-
"oneOf": [
|
|
97
|
-
{
|
|
98
|
-
"type": "boolean"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"type": "object",
|
|
102
|
-
"properties": {
|
|
103
|
-
"async": {
|
|
104
|
-
"type": "boolean",
|
|
105
|
-
"description": "Run type checking in a separate process without blocking the build.",
|
|
106
|
-
"default": true
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
"additionalProperties": false
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
},
|
|
113
|
-
"sourceMap": {
|
|
114
|
-
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
|
|
115
|
-
"oneOf": [
|
|
116
|
-
{
|
|
117
|
-
"type": "boolean"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
"type": "string"
|
|
121
|
-
}
|
|
122
|
-
]
|
|
123
|
-
},
|
|
124
|
-
"progress": {
|
|
125
|
-
"type": "boolean",
|
|
126
|
-
"description": "Log progress to the console while building."
|
|
127
|
-
},
|
|
128
|
-
"poll": {
|
|
129
|
-
"type": "number",
|
|
130
|
-
"description": "Enable and define the file watching poll time period."
|
|
131
|
-
},
|
|
132
|
-
"assets": {
|
|
133
|
-
"type": "array",
|
|
134
|
-
"description": "List of static application assets.",
|
|
135
|
-
"items": {
|
|
136
|
-
"$ref": "#/definitions/assetPattern"
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
"index": {
|
|
140
|
-
"type": "string",
|
|
141
|
-
"description": "HTML File which will be contain the application.",
|
|
142
|
-
"x-completion-type": "file",
|
|
143
|
-
"x-completion-glob": "**/*@(.html|.htm)"
|
|
144
|
-
},
|
|
145
|
-
"scripts": {
|
|
146
|
-
"type": "array",
|
|
147
|
-
"description": "External Scripts which will be included before the main application entry.",
|
|
148
|
-
"items": {
|
|
149
|
-
"$ref": "#/definitions/extraEntryPoint"
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
"styles": {
|
|
153
|
-
"type": "array",
|
|
154
|
-
"description": "External Styles which will be included with the application",
|
|
155
|
-
"items": {
|
|
156
|
-
"$ref": "#/definitions/extraEntryPoint"
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
"namedChunks": {
|
|
160
|
-
"type": "boolean",
|
|
161
|
-
"description": "Names the produced bundles according to their entry file."
|
|
162
|
-
},
|
|
163
|
-
"outputHashing": {
|
|
164
|
-
"type": "string",
|
|
165
|
-
"description": "Define the output filename cache-busting hashing mode.",
|
|
166
|
-
"enum": ["none", "all", "media", "bundles"]
|
|
167
|
-
},
|
|
168
|
-
"stylePreprocessorOptions": {
|
|
169
|
-
"description": "Options to pass to style preprocessors.",
|
|
170
|
-
"type": "object",
|
|
171
|
-
"properties": {
|
|
172
|
-
"includePaths": {
|
|
173
|
-
"description": "Paths to include. Paths will be resolved to project root.",
|
|
174
|
-
"type": "array",
|
|
175
|
-
"items": {
|
|
176
|
-
"type": "string"
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
"additionalProperties": false
|
|
181
|
-
},
|
|
182
|
-
"optimization": {
|
|
183
|
-
"description": "Enables optimization of the build output.",
|
|
184
|
-
"oneOf": [
|
|
185
|
-
{
|
|
186
|
-
"type": "object",
|
|
187
|
-
"properties": {
|
|
188
|
-
"scripts": {
|
|
189
|
-
"type": "boolean",
|
|
190
|
-
"description": "Enables optimization of the scripts output.",
|
|
191
|
-
"default": true
|
|
192
|
-
},
|
|
193
|
-
"styles": {
|
|
194
|
-
"type": "boolean",
|
|
195
|
-
"description": "Enables optimization of the styles output.",
|
|
196
|
-
"default": true
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
"additionalProperties": false
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
"type": "boolean"
|
|
203
|
-
}
|
|
204
|
-
]
|
|
205
|
-
},
|
|
206
|
-
"generatePackageJson": {
|
|
207
|
-
"type": "boolean",
|
|
208
|
-
"description": "Generates a `package.json` and pruned lock file with the project's `node_module` dependencies populated for installing in a container. If a `package.json` exists in the project's directory, it will be reused with dependencies populated."
|
|
209
|
-
},
|
|
210
|
-
"skipOverrides": {
|
|
211
|
-
"type": "boolean",
|
|
212
|
-
"description": "Do not add a `overrides` and `resolutions` entries to the generated package.json file. Only works in conjunction with `generatePackageJson` option."
|
|
213
|
-
},
|
|
214
|
-
"skipPackageManager": {
|
|
215
|
-
"type": "boolean",
|
|
216
|
-
"description": "Do not add a `packageManager` entry to the generated package.json file. Only works in conjunction with `generatePackageJson` option."
|
|
217
|
-
},
|
|
218
|
-
"transformers": {
|
|
219
|
-
"type": "array",
|
|
220
|
-
"description": "List of TypeScript Compiler Transfomers Plugins.",
|
|
221
|
-
"aliases": ["tsPlugins"],
|
|
222
|
-
"items": {
|
|
223
|
-
"$ref": "#/definitions/transformerPattern"
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
"additionalEntryPoints": {
|
|
227
|
-
"type": "array",
|
|
228
|
-
"items": {
|
|
229
|
-
"type": "object",
|
|
230
|
-
"properties": {
|
|
231
|
-
"entryName": {
|
|
232
|
-
"type": "string",
|
|
233
|
-
"description": "Name of the additional entry file."
|
|
234
|
-
},
|
|
235
|
-
"entryPath": {
|
|
236
|
-
"type": "string",
|
|
237
|
-
"description": "Path to the additional entry file.",
|
|
238
|
-
"x-completion-type": "file",
|
|
239
|
-
"x-completion-glob": "**/*@(.js|.ts)"
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
"outputFileName": {
|
|
245
|
-
"type": "string",
|
|
246
|
-
"description": "Name of the main output file.",
|
|
247
|
-
"default": "main.js"
|
|
248
|
-
},
|
|
249
|
-
"externalDependencies": {
|
|
250
|
-
"oneOf": [
|
|
251
|
-
{
|
|
252
|
-
"type": "string",
|
|
253
|
-
"enum": ["none", "all"]
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
"type": "array",
|
|
257
|
-
"items": {
|
|
258
|
-
"type": "string"
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
],
|
|
262
|
-
"description": "Dependencies to keep external to the bundle. (`all` (default), `none`, or an array of module names)"
|
|
263
|
-
},
|
|
264
|
-
"extractCss": {
|
|
265
|
-
"type": "boolean",
|
|
266
|
-
"description": "Extract CSS into a `.css` file."
|
|
267
|
-
},
|
|
268
|
-
"cssModuleHashFunction": {
|
|
269
|
-
"type": "string",
|
|
270
|
-
"description": "Hash algorithm used to generate CSS module class names. Defaults to `md5`, which FIPS-restricted OpenSSL rejects. Changing it renames generated class names."
|
|
271
|
-
},
|
|
272
|
-
"subresourceIntegrity": {
|
|
273
|
-
"type": "boolean",
|
|
274
|
-
"description": "Enables the use of subresource integrity validation."
|
|
275
|
-
},
|
|
276
|
-
"polyfills": {
|
|
277
|
-
"type": "string",
|
|
278
|
-
"description": "Polyfills to load before application",
|
|
279
|
-
"x-completion-type": "file",
|
|
280
|
-
"x-completion-glob": "**/*@(.js|.ts|.tsx)"
|
|
281
|
-
},
|
|
282
|
-
"verbose": {
|
|
283
|
-
"type": "boolean",
|
|
284
|
-
"description": "Emits verbose output"
|
|
285
|
-
},
|
|
286
|
-
"statsJson": {
|
|
287
|
-
"type": "boolean",
|
|
288
|
-
"description": "Generates a 'stats.json' file which can be analyzed using tools such as: 'webpack-bundle-analyzer' or `<https://webpack.github.io/analyse>`."
|
|
289
|
-
},
|
|
290
|
-
"runtimeDependencies": {
|
|
291
|
-
"description": "Add runtime dependencies to the generated `package.json` file. Useful for Docker install.",
|
|
292
|
-
"type": "array",
|
|
293
|
-
"items": {
|
|
294
|
-
"type": "string"
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
"standardWebpackConfigFunction": {
|
|
298
|
-
"type": "boolean",
|
|
299
|
-
"description": "Set to true if the webpack config exports a standard webpack function, not an Nx-specific one. See: https://webpack.js.org/configuration/configuration-types/#exporting-a-function",
|
|
300
|
-
"default": false
|
|
301
|
-
},
|
|
302
|
-
"extractLicenses": {
|
|
303
|
-
"type": "boolean",
|
|
304
|
-
"description": "Extract all licenses in a separate file, in the case of production builds only."
|
|
305
|
-
},
|
|
306
|
-
"memoryLimit": {
|
|
307
|
-
"type": "number",
|
|
308
|
-
"description": "Memory limit for type checking service process in `MB`."
|
|
309
|
-
},
|
|
310
|
-
"fileReplacements": {
|
|
311
|
-
"description": "Replace files with other files in the build.",
|
|
312
|
-
"type": "array",
|
|
313
|
-
"items": {
|
|
314
|
-
"type": "object",
|
|
315
|
-
"properties": {
|
|
316
|
-
"replace": {
|
|
317
|
-
"type": "string",
|
|
318
|
-
"description": "The file to be replaced.",
|
|
319
|
-
"x-completion-type": "file"
|
|
320
|
-
},
|
|
321
|
-
"with": {
|
|
322
|
-
"type": "string",
|
|
323
|
-
"description": "The file to replace with.",
|
|
324
|
-
"x-completion-type": "file"
|
|
325
|
-
}
|
|
326
|
-
},
|
|
327
|
-
"additionalProperties": false,
|
|
328
|
-
"required": ["replace", "with"]
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
"buildLibsFromSource": {
|
|
332
|
-
"type": "boolean",
|
|
333
|
-
"description": "Read buildable libraries from source instead of building them separately. If set to `false`, the `tsConfig` option must also be set to remap paths.",
|
|
334
|
-
"default": true
|
|
335
|
-
},
|
|
336
|
-
"generateIndexHtml": {
|
|
337
|
-
"type": "boolean",
|
|
338
|
-
"description": "Generates `index.html` file to the output path. This can be turned off if using a webpack plugin to generate HTML such as `html-webpack-plugin`."
|
|
339
|
-
},
|
|
340
|
-
"postcssConfig": {
|
|
341
|
-
"type": "string",
|
|
342
|
-
"description": "Set a path to PostCSS config that applies to the app and all libs. Defaults to `undefined`, which auto-detects postcss.config.js files in each `app`/`lib` directory."
|
|
343
|
-
},
|
|
344
|
-
"webpackConfig": {
|
|
345
|
-
"type": "string",
|
|
346
|
-
"description": "Path to a function which takes a webpack config, some context and returns the resulting webpack config. See https://nx.dev/guides/customize-webpack",
|
|
347
|
-
"x-completion-type": "file",
|
|
348
|
-
"x-completion-glob": "webpack?(*)@(.js|.ts)",
|
|
349
|
-
"x-priority": "important"
|
|
350
|
-
},
|
|
351
|
-
"babelUpwardRootMode": {
|
|
352
|
-
"type": "boolean",
|
|
353
|
-
"description": "Whether to set rootmode to upward. See https://babeljs.io/docs/en/options#rootmode"
|
|
354
|
-
},
|
|
355
|
-
"babelConfig": {
|
|
356
|
-
"type": "string",
|
|
357
|
-
"description": "Path to the babel configuration file of your project. If not provided, Nx will default to the .babelrc file at the root of your project. See https://babeljs.io/docs/en/config-files",
|
|
358
|
-
"x-completion-type": "file"
|
|
359
|
-
},
|
|
360
|
-
"publicPath": {
|
|
361
|
-
"type": "string",
|
|
362
|
-
"description": "Set a public path for assets resources with absolute paths."
|
|
363
|
-
},
|
|
364
|
-
"rebaseRootRelative": {
|
|
365
|
-
"type": "boolean",
|
|
366
|
-
"description": "Whether to rebase absolute path for assets in postcss cli resources."
|
|
367
|
-
}
|
|
368
|
-
},
|
|
369
|
-
"required": [],
|
|
370
|
-
"definitions": {
|
|
371
|
-
"assetPattern": {
|
|
372
|
-
"oneOf": [
|
|
373
|
-
{
|
|
374
|
-
"type": "object",
|
|
375
|
-
"properties": {
|
|
376
|
-
"glob": {
|
|
377
|
-
"type": "string",
|
|
378
|
-
"description": "The pattern to match."
|
|
379
|
-
},
|
|
380
|
-
"input": {
|
|
381
|
-
"type": "string",
|
|
382
|
-
"description": "The input directory path in which to apply 'glob'. Defaults to the project root."
|
|
383
|
-
},
|
|
384
|
-
"ignore": {
|
|
385
|
-
"description": "An array of globs to ignore.",
|
|
386
|
-
"type": "array",
|
|
387
|
-
"items": {
|
|
388
|
-
"type": "string"
|
|
389
|
-
}
|
|
390
|
-
},
|
|
391
|
-
"output": {
|
|
392
|
-
"type": "string",
|
|
393
|
-
"description": "Absolute path within the output."
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
"additionalProperties": false,
|
|
397
|
-
"required": ["glob", "input", "output"]
|
|
398
|
-
},
|
|
399
|
-
{
|
|
400
|
-
"type": "string"
|
|
401
|
-
}
|
|
402
|
-
]
|
|
403
|
-
},
|
|
404
|
-
"extraEntryPoint": {
|
|
405
|
-
"oneOf": [
|
|
406
|
-
{
|
|
407
|
-
"type": "object",
|
|
408
|
-
"properties": {
|
|
409
|
-
"input": {
|
|
410
|
-
"type": "string",
|
|
411
|
-
"description": "The file to include.",
|
|
412
|
-
"x-completion-type": "file",
|
|
413
|
-
"x-completion-glob": "**/*@(.css|.scss|.less|.sass)"
|
|
414
|
-
},
|
|
415
|
-
"bundleName": {
|
|
416
|
-
"type": "string",
|
|
417
|
-
"description": "The bundle name for this extra entry point."
|
|
418
|
-
},
|
|
419
|
-
"inject": {
|
|
420
|
-
"type": "boolean",
|
|
421
|
-
"description": "If the bundle will be referenced in the HTML file.",
|
|
422
|
-
"default": true
|
|
423
|
-
}
|
|
424
|
-
},
|
|
425
|
-
"additionalProperties": false,
|
|
426
|
-
"required": ["input"]
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
"type": "string",
|
|
430
|
-
"description": "The file to include.",
|
|
431
|
-
"x-completion-type": "file",
|
|
432
|
-
"x-completion-glob": "**/*@(.css|.scss|.less|.sass)"
|
|
433
|
-
}
|
|
434
|
-
]
|
|
435
|
-
},
|
|
436
|
-
"transformerPattern": {
|
|
437
|
-
"oneOf": [
|
|
438
|
-
{
|
|
439
|
-
"type": "string"
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
"type": "object",
|
|
443
|
-
"properties": {
|
|
444
|
-
"name": {
|
|
445
|
-
"type": "string"
|
|
446
|
-
},
|
|
447
|
-
"options": {
|
|
448
|
-
"type": "object",
|
|
449
|
-
"additionalProperties": true
|
|
450
|
-
}
|
|
451
|
-
},
|
|
452
|
-
"additionalProperties": false,
|
|
453
|
-
"required": ["name"]
|
|
454
|
-
}
|
|
455
|
-
]
|
|
456
|
-
}
|
|
457
|
-
},
|
|
458
|
-
"examplesFile": "../../../docs/webpack-build-executor-examples.md"
|
|
459
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
-
import type { WebpackExecutorOptions } from './schema';
|
|
3
|
-
export type WebpackExecutorEvent = {
|
|
4
|
-
success: false;
|
|
5
|
-
outfile?: string;
|
|
6
|
-
options?: WebpackExecutorOptions;
|
|
7
|
-
} | {
|
|
8
|
-
success: true;
|
|
9
|
-
outfile: string;
|
|
10
|
-
options?: WebpackExecutorOptions;
|
|
11
|
-
};
|
|
12
|
-
export declare function webpackExecutor(_options: WebpackExecutorOptions, context: ExecutorContext): AsyncGenerator<WebpackExecutorEvent, WebpackExecutorEvent, undefined>;
|
|
13
|
-
export default webpackExecutor;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.webpackExecutor = webpackExecutor;
|
|
4
|
-
const internal_1 = require("@nx/devkit/internal");
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const js_1 = require("@nx/js");
|
|
7
|
-
const internal_2 = require("@nx/js/internal");
|
|
8
|
-
const path_1 = require("path");
|
|
9
|
-
const rxjs_1 = require("rxjs");
|
|
10
|
-
const operators_1 = require("rxjs/operators");
|
|
11
|
-
const config_1 = require("../../utils/config");
|
|
12
|
-
const resolve_user_defined_webpack_config_1 = require("../../utils/webpack/resolve-user-defined-webpack-config");
|
|
13
|
-
const deprecation_1 = require("../../utils/deprecation");
|
|
14
|
-
const normalize_options_1 = require("./lib/normalize-options");
|
|
15
|
-
const run_webpack_1 = require("./lib/run-webpack");
|
|
16
|
-
async function getWebpackConfigs(options, context) {
|
|
17
|
-
let userDefinedWebpackConfig = null;
|
|
18
|
-
if (options.webpackConfig) {
|
|
19
|
-
userDefinedWebpackConfig = (0, resolve_user_defined_webpack_config_1.resolveUserDefinedWebpackConfig)(options.webpackConfig, (0, js_1.getRootTsConfigPath)());
|
|
20
|
-
if (typeof userDefinedWebpackConfig.then === 'function') {
|
|
21
|
-
userDefinedWebpackConfig = await userDefinedWebpackConfig;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const config = {};
|
|
25
|
-
if (typeof userDefinedWebpackConfig === 'function' &&
|
|
26
|
-
((0, config_1.isNxWebpackComposablePlugin)(userDefinedWebpackConfig) ||
|
|
27
|
-
!options.standardWebpackConfigFunction)) {
|
|
28
|
-
// Old behavior, call the Nx-specific webpack config function that user exports
|
|
29
|
-
return await userDefinedWebpackConfig(config, {
|
|
30
|
-
options,
|
|
31
|
-
context,
|
|
32
|
-
configuration: context.configurationName, // backwards compat
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
else if (userDefinedWebpackConfig) {
|
|
36
|
-
if (typeof userDefinedWebpackConfig === 'function') {
|
|
37
|
-
// assume it's an async standard webpack config function
|
|
38
|
-
// https://webpack.js.org/configuration/configuration-types/#exporting-a-promise
|
|
39
|
-
return await userDefinedWebpackConfig(process.env.NODE_ENV, {});
|
|
40
|
-
}
|
|
41
|
-
// New behavior, we want the webpack config to export object
|
|
42
|
-
return userDefinedWebpackConfig;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
// Fallback case, if we cannot find a webpack config path
|
|
46
|
-
return config;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
async function* webpackExecutor(_options, context) {
|
|
50
|
-
(0, deprecation_1.warnWebpackExecutorDeprecation)();
|
|
51
|
-
// Default to production build.
|
|
52
|
-
process.env['NODE_ENV'] ||= 'production';
|
|
53
|
-
const metadata = context.projectsConfigurations.projects[context.projectName];
|
|
54
|
-
const sourceRoot = (0, internal_2.getProjectSourceRoot)(metadata);
|
|
55
|
-
const options = (0, normalize_options_1.normalizeOptions)(_options, context.root, metadata.root, sourceRoot);
|
|
56
|
-
const isScriptOptimizeOn = typeof options.optimization === 'boolean'
|
|
57
|
-
? options.optimization
|
|
58
|
-
: options.optimization && options.optimization.scripts
|
|
59
|
-
? options.optimization.scripts
|
|
60
|
-
: false;
|
|
61
|
-
process.env.NODE_ENV ||= isScriptOptimizeOn
|
|
62
|
-
? 'production'
|
|
63
|
-
: 'development';
|
|
64
|
-
process.env.NX_BUILD_LIBS_FROM_SOURCE = `${options.buildLibsFromSource}`;
|
|
65
|
-
process.env.NX_BUILD_TARGET = (0, devkit_1.targetToTargetString)({
|
|
66
|
-
project: context.projectName,
|
|
67
|
-
target: context.targetName,
|
|
68
|
-
configuration: context.configurationName,
|
|
69
|
-
});
|
|
70
|
-
if (options.compiler === 'swc') {
|
|
71
|
-
try {
|
|
72
|
-
require.resolve('swc-loader');
|
|
73
|
-
require.resolve('@swc/core');
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
devkit_1.logger.error(`Missing SWC dependencies: @swc/core, swc-loader. Make sure you install them first.`);
|
|
77
|
-
return {
|
|
78
|
-
success: false,
|
|
79
|
-
options,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (options.generatePackageJson && metadata.projectType !== 'application') {
|
|
84
|
-
devkit_1.logger.warn((0, devkit_1.stripIndents) `The project ${context.projectName} is using the 'generatePackageJson' option which is deprecated for library projects. It should only be used for applications.
|
|
85
|
-
For libraries, configure the project to use the '@nx/dependency-checks' ESLint rule instead (https://nx.dev/nx-api/eslint-plugin/documents/dependency-checks).`);
|
|
86
|
-
}
|
|
87
|
-
const configs = await getWebpackConfigs(options, context);
|
|
88
|
-
return yield* (0, internal_1.eachValueFrom)((0, rxjs_1.of)(configs).pipe((0, operators_1.mergeMap)((config) => (Array.isArray(config) ? (0, rxjs_1.from)(config) : (0, rxjs_1.of)(config))),
|
|
89
|
-
// Run build sequentially and bail when first one fails.
|
|
90
|
-
(0, operators_1.mergeScan)((acc, config) => {
|
|
91
|
-
if (!acc.hasErrors()) {
|
|
92
|
-
// Propagate watch mode from executor options to webpack config.
|
|
93
|
-
// Without this, NxAppWebpackPlugin-based configs run in single-run
|
|
94
|
-
// mode even when the executor is invoked with watch: true, causing
|
|
95
|
-
// @nx/js:node to restart the process after every build.
|
|
96
|
-
config.watch = options.watch ?? config.watch;
|
|
97
|
-
return (0, run_webpack_1.runWebpack)(config).pipe((0, operators_1.tap)((stats) => {
|
|
98
|
-
console.info(stats.toString(config.stats));
|
|
99
|
-
}));
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
return (0, rxjs_1.of)();
|
|
103
|
-
}
|
|
104
|
-
}, { hasErrors: () => false }, 1),
|
|
105
|
-
// Collect build results as an array.
|
|
106
|
-
(0, operators_1.bufferCount)(Array.isArray(configs) ? configs.length : 1), (0, operators_1.switchMap)(async (results) => {
|
|
107
|
-
const success = results.every((result) => Boolean(result) && !result.hasErrors());
|
|
108
|
-
// TODO(jack): This should read output from webpack config if provided.
|
|
109
|
-
// The outfile is only used by NestJS, where `@nx/js:node` executor requires it to run the file.
|
|
110
|
-
return {
|
|
111
|
-
success,
|
|
112
|
-
outfile: (0, path_1.resolve)(context.root, options.outputPath, options.outputFileName),
|
|
113
|
-
options,
|
|
114
|
-
};
|
|
115
|
-
})));
|
|
116
|
-
}
|
|
117
|
-
exports.default = webpackExecutor;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasPlugin = hasPlugin;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function hasPlugin(tree) {
|
|
6
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
|
-
return !!nxJson.plugins?.some((p) => typeof p === 'string'
|
|
8
|
-
? p === '@nx/webpack/plugin'
|
|
9
|
-
: p.plugin === '@nx/webpack/plugin');
|
|
10
|
-
}
|