@nx/webpack 0.0.0-pr-30418-4e2b721 → 0.0.0-pr-3-ec41644
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/migrations.json +0 -9
- package/package.json +5 -6
- package/src/executors/webpack/lib/normalize-options.js +0 -1
- package/src/executors/webpack/schema.d.ts +0 -1
- package/src/executors/webpack/schema.json +0 -6
- package/src/plugins/nx-webpack-plugin/lib/apply-web-config.js +3 -20
- package/src/plugins/nx-webpack-plugin/lib/normalize-options.js +1 -5
- package/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.d.ts +1 -9
- package/src/plugins/plugin.js +3 -0
- package/src/plugins/webpack-nx-build-coordination-plugin.js +2 -1
- package/src/utils/with-web.d.ts +1 -6
package/migrations.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-3-ec41644",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Webpack contains executors and generators that support building applications using Webpack.",
|
|
6
6
|
"repository": {
|
|
@@ -51,9 +51,8 @@
|
|
|
51
51
|
"postcss-import": "~14.1.0",
|
|
52
52
|
"postcss-loader": "^6.1.1",
|
|
53
53
|
"rxjs": "^7.8.0",
|
|
54
|
-
"sass": "^1.
|
|
55
|
-
"sass-
|
|
56
|
-
"sass-loader": "^16.0.4",
|
|
54
|
+
"sass": "^1.42.1",
|
|
55
|
+
"sass-loader": "^12.2.0",
|
|
57
56
|
"source-map-loader": "^5.0.0",
|
|
58
57
|
"style-loader": "^3.3.0",
|
|
59
58
|
"stylus": "^0.64.0",
|
|
@@ -66,8 +65,8 @@
|
|
|
66
65
|
"webpack-dev-server": "^5.0.4",
|
|
67
66
|
"webpack-node-externals": "^3.0.0",
|
|
68
67
|
"webpack-subresource-integrity": "^5.1.0",
|
|
69
|
-
"@nx/devkit": "0.0.0-pr-
|
|
70
|
-
"@nx/js": "0.0.0-pr-
|
|
68
|
+
"@nx/devkit": "0.0.0-pr-3-ec41644",
|
|
69
|
+
"@nx/js": "0.0.0-pr-3-ec41644"
|
|
71
70
|
},
|
|
72
71
|
"publishConfig": {
|
|
73
72
|
"access": "public"
|
|
@@ -16,7 +16,6 @@ function normalizeOptions(options, root, projectRoot, sourceRoot) {
|
|
|
16
16
|
outputFileName: options.outputFileName ?? 'main.js',
|
|
17
17
|
webpackConfig: normalizePluginPath(options.webpackConfig, root),
|
|
18
18
|
fileReplacements: (0, normalize_options_1.normalizeFileReplacements)(root, options.fileReplacements),
|
|
19
|
-
sassImplementation: options.sassImplementation ?? 'sass',
|
|
20
19
|
optimization: typeof options.optimization !== 'object'
|
|
21
20
|
? {
|
|
22
21
|
scripts: options.optimization,
|
|
@@ -81,7 +81,6 @@ export interface WebpackExecutorOptions {
|
|
|
81
81
|
index?: string;
|
|
82
82
|
postcssConfig?: string;
|
|
83
83
|
scripts?: Array<ExtraEntryPointClass | string>;
|
|
84
|
-
sassImplementation?: 'sass' | 'sass-embedded';
|
|
85
84
|
stylePreprocessorOptions?: any;
|
|
86
85
|
styles?: Array<ExtraEntryPointClass | string>;
|
|
87
86
|
subresourceIntegrity?: boolean;
|
|
@@ -144,12 +144,6 @@
|
|
|
144
144
|
},
|
|
145
145
|
"additionalProperties": false
|
|
146
146
|
},
|
|
147
|
-
"sassImplementation": {
|
|
148
|
-
"type": "string",
|
|
149
|
-
"description": "The implementation of the SASS compiler to use. Can be either `sass` or `sass-embedded`. Defaults to `sass-embedded`.",
|
|
150
|
-
"enum": ["sass", "sass-embedded"],
|
|
151
|
-
"default": "sass"
|
|
152
|
-
},
|
|
153
147
|
"optimization": {
|
|
154
148
|
"description": "Enables optimization of the build output.",
|
|
155
149
|
"oneOf": [
|
|
@@ -56,8 +56,6 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
56
56
|
const globalStylePaths = [];
|
|
57
57
|
// Determine hashing format.
|
|
58
58
|
const hashFormat = (0, hash_format_1.getOutputHashFormat)(options.outputHashing);
|
|
59
|
-
const sassOptions = options.stylePreprocessorOptions?.sassOptions;
|
|
60
|
-
const lessOptions = options.stylePreprocessorOptions?.lessOptions;
|
|
61
59
|
const includePaths = [];
|
|
62
60
|
if (options?.stylePreprocessorOptions?.includePaths?.length > 0) {
|
|
63
61
|
options.stylePreprocessorOptions.includePaths.forEach((includePath) => includePaths.push(path.resolve(options.root, includePath)));
|
|
@@ -99,15 +97,11 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
99
97
|
{
|
|
100
98
|
loader: require.resolve('sass-loader'),
|
|
101
99
|
options: {
|
|
102
|
-
|
|
103
|
-
implementation: options.sassImplementation === 'sass-embedded'
|
|
104
|
-
? require.resolve('sass-embedded')
|
|
105
|
-
: require.resolve('sass'),
|
|
100
|
+
implementation: require('sass'),
|
|
106
101
|
sassOptions: {
|
|
107
102
|
fiber: false,
|
|
108
103
|
precision: 8,
|
|
109
104
|
includePaths,
|
|
110
|
-
...(sassOptions ?? {}),
|
|
111
105
|
},
|
|
112
106
|
},
|
|
113
107
|
},
|
|
@@ -123,7 +117,6 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
123
117
|
options: {
|
|
124
118
|
lessOptions: {
|
|
125
119
|
paths: includePaths,
|
|
126
|
-
...(lessOptions ?? {}),
|
|
127
120
|
},
|
|
128
121
|
},
|
|
129
122
|
},
|
|
@@ -159,17 +152,13 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
159
152
|
{
|
|
160
153
|
loader: require.resolve('sass-loader'),
|
|
161
154
|
options: {
|
|
162
|
-
|
|
163
|
-
implementation: options.sassImplementation === 'sass-embedded'
|
|
164
|
-
? require.resolve('sass-embedded')
|
|
165
|
-
: require.resolve('sass'),
|
|
155
|
+
implementation: require('sass'),
|
|
166
156
|
sourceMap: !!options.sourceMap,
|
|
167
157
|
sassOptions: {
|
|
168
158
|
fiber: false,
|
|
169
159
|
// bootstrap-sass requires a minimum precision of 8
|
|
170
160
|
precision: 8,
|
|
171
161
|
includePaths,
|
|
172
|
-
...(sassOptions ?? {}),
|
|
173
162
|
},
|
|
174
163
|
},
|
|
175
164
|
},
|
|
@@ -187,7 +176,6 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
187
176
|
lessOptions: {
|
|
188
177
|
javascriptEnabled: true,
|
|
189
178
|
...lessPathOptions,
|
|
190
|
-
...(lessOptions ?? {}),
|
|
191
179
|
},
|
|
192
180
|
},
|
|
193
181
|
},
|
|
@@ -224,17 +212,13 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
224
212
|
{
|
|
225
213
|
loader: require.resolve('sass-loader'),
|
|
226
214
|
options: {
|
|
227
|
-
|
|
228
|
-
implementation: options.sassImplementation === 'sass-embedded'
|
|
229
|
-
? require.resolve('sass-embedded')
|
|
230
|
-
: require.resolve('sass'),
|
|
215
|
+
implementation: require('sass'),
|
|
231
216
|
sourceMap: !!options.sourceMap,
|
|
232
217
|
sassOptions: {
|
|
233
218
|
fiber: false,
|
|
234
219
|
// bootstrap-sass requires a minimum precision of 8
|
|
235
220
|
precision: 8,
|
|
236
221
|
includePaths,
|
|
237
|
-
...(sassOptions ?? {}),
|
|
238
222
|
},
|
|
239
223
|
},
|
|
240
224
|
},
|
|
@@ -252,7 +236,6 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
252
236
|
lessOptions: {
|
|
253
237
|
javascriptEnabled: true,
|
|
254
238
|
...lessPathOptions,
|
|
255
|
-
...(lessOptions ?? {}),
|
|
256
239
|
},
|
|
257
240
|
},
|
|
258
241
|
},
|
|
@@ -48,10 +48,7 @@ function normalizeOptions(options) {
|
|
|
48
48
|
// executor options take precedence (especially for overriding with CLI args)
|
|
49
49
|
originalTargetOptions);
|
|
50
50
|
}
|
|
51
|
-
const sourceRoot = projectNode.data.sourceRoot ??
|
|
52
|
-
((0, fs_1.existsSync)((0, path_1.join)(devkit_1.workspaceRoot, projectNode.data.root, 'src'))
|
|
53
|
-
? (0, path_1.join)(projectNode.data.root, 'src')
|
|
54
|
-
: projectNode.data.root);
|
|
51
|
+
const sourceRoot = projectNode.data.sourceRoot ?? projectNode.data.root;
|
|
55
52
|
if (!combinedPluginAndMaybeExecutorOptions.main) {
|
|
56
53
|
throw new Error(`Missing "main" option for the entry file. Set this option in your Nx webpack plugin.`);
|
|
57
54
|
}
|
|
@@ -88,7 +85,6 @@ function normalizeOptions(options) {
|
|
|
88
85
|
target: combinedPluginAndMaybeExecutorOptions.target,
|
|
89
86
|
targetName,
|
|
90
87
|
vendorChunk: combinedPluginAndMaybeExecutorOptions.vendorChunk ?? !isProd,
|
|
91
|
-
sassImplementation: combinedPluginAndMaybeExecutorOptions.sassImplementation ?? 'sass',
|
|
92
88
|
};
|
|
93
89
|
}
|
|
94
90
|
function normalizeAssets(assets, root, sourceRoot, projectRoot, resolveRelativePathsToProjectRoot = true) {
|
|
@@ -185,11 +185,7 @@ export interface NxAppWebpackPluginOptions {
|
|
|
185
185
|
/**
|
|
186
186
|
* Options for the style preprocessor. e.g. `{ "includePaths": [] }` for SASS.
|
|
187
187
|
*/
|
|
188
|
-
stylePreprocessorOptions?:
|
|
189
|
-
includePaths?: string[];
|
|
190
|
-
sassOptions?: Record<string, any>;
|
|
191
|
-
lessOptions?: Record<string, any>;
|
|
192
|
-
};
|
|
188
|
+
stylePreprocessorOptions?: any;
|
|
193
189
|
/**
|
|
194
190
|
* External stylesheets that will be included with the application.
|
|
195
191
|
*/
|
|
@@ -210,10 +206,6 @@ export interface NxAppWebpackPluginOptions {
|
|
|
210
206
|
* Use tsconfig-paths-webpack-plugin to resolve modules using paths in the tsconfig file.
|
|
211
207
|
*/
|
|
212
208
|
useTsconfigPaths?: boolean;
|
|
213
|
-
/**
|
|
214
|
-
* The implementation of the SASS compiler to use. Can be either `sass` or `sass-embedded`. Defaults to `sass-embedded`.
|
|
215
|
-
*/
|
|
216
|
-
sassImplementation?: 'sass' | 'sass-embedded';
|
|
217
209
|
/**
|
|
218
210
|
* Generate a separate vendor chunk for 3rd party packages.
|
|
219
211
|
*/
|
package/src/plugins/plugin.js
CHANGED
|
@@ -120,6 +120,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
|
|
|
120
120
|
},
|
|
121
121
|
};
|
|
122
122
|
targets[options.serveTargetName] = {
|
|
123
|
+
continuous: true,
|
|
123
124
|
command: `webpack-cli serve`,
|
|
124
125
|
options: {
|
|
125
126
|
cwd: projectRoot,
|
|
@@ -139,6 +140,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
|
|
|
139
140
|
},
|
|
140
141
|
};
|
|
141
142
|
targets[options.previewTargetName] = {
|
|
143
|
+
continuous: true,
|
|
142
144
|
command: `webpack-cli serve`,
|
|
143
145
|
options: {
|
|
144
146
|
cwd: projectRoot,
|
|
@@ -158,6 +160,7 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
|
|
|
158
160
|
},
|
|
159
161
|
};
|
|
160
162
|
targets[options.serveStaticTargetName] = {
|
|
163
|
+
continuous: true,
|
|
161
164
|
dependsOn: [options.buildTargetName],
|
|
162
165
|
executor: '@nx/web:file-server',
|
|
163
166
|
options: {
|
|
@@ -5,6 +5,7 @@ const child_process_1 = require("child_process");
|
|
|
5
5
|
const client_1 = require("nx/src/daemon/client/client");
|
|
6
6
|
const watch_1 = require("nx/src/command-line/watch/watch");
|
|
7
7
|
const output_1 = require("nx/src/utils/output");
|
|
8
|
+
const enabled_1 = require("nx/src/daemon/client/enabled");
|
|
8
9
|
class WebpackNxBuildCoordinationPlugin {
|
|
9
10
|
constructor(buildCmd, skipInitialBuildOrOptions) {
|
|
10
11
|
this.buildCmd = buildCmd;
|
|
@@ -17,7 +18,7 @@ class WebpackNxBuildCoordinationPlugin {
|
|
|
17
18
|
this.buildChangedProjects();
|
|
18
19
|
}
|
|
19
20
|
if (!options?.skipWatchingDeps) {
|
|
20
|
-
if ((0,
|
|
21
|
+
if ((0, enabled_1.isDaemonEnabled)()) {
|
|
21
22
|
this.startWatchingBuildableLibs();
|
|
22
23
|
}
|
|
23
24
|
else {
|
package/src/utils/with-web.d.ts
CHANGED
|
@@ -8,13 +8,8 @@ export interface WithWebOptions {
|
|
|
8
8
|
generateIndexHtml?: boolean;
|
|
9
9
|
index?: string;
|
|
10
10
|
postcssConfig?: string;
|
|
11
|
-
sassImplementation?: 'sass' | 'sass-embedded';
|
|
12
11
|
scripts?: Array<ExtraEntryPointClass | string>;
|
|
13
|
-
stylePreprocessorOptions?:
|
|
14
|
-
includePaths?: string[];
|
|
15
|
-
sassOptions?: Record<string, any>;
|
|
16
|
-
lessOptions?: Record<string, any>;
|
|
17
|
-
};
|
|
12
|
+
stylePreprocessorOptions?: any;
|
|
18
13
|
styles?: Array<ExtraEntryPointClass | string>;
|
|
19
14
|
subresourceIntegrity?: boolean;
|
|
20
15
|
ssr?: boolean;
|