@nx/webpack 20.5.0-beta.3 → 20.5.0-beta.5
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 +13 -0
- package/package.json +6 -5
- package/src/executors/webpack/lib/normalize-options.js +1 -0
- package/src/executors/webpack/schema.d.ts +1 -0
- package/src/executors/webpack/schema.json +6 -0
- package/src/plugins/nx-webpack-plugin/lib/apply-web-config.js +20 -3
- package/src/plugins/nx-webpack-plugin/lib/normalize-options.js +1 -0
- package/src/plugins/nx-webpack-plugin/nx-app-webpack-plugin-options.d.ts +9 -1
- package/src/utils/with-web.d.ts +6 -1
package/migrations.json
CHANGED
|
@@ -35,6 +35,19 @@
|
|
|
35
35
|
"alwaysAddToPackageJson": false
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
},
|
|
39
|
+
"20.5.0": {
|
|
40
|
+
"version": "20.5.0-beta.3",
|
|
41
|
+
"packages": {
|
|
42
|
+
"sass-loader": {
|
|
43
|
+
"version": "^16.0.4",
|
|
44
|
+
"alwaysAddToPackageJson": false
|
|
45
|
+
},
|
|
46
|
+
"sass-embedded": {
|
|
47
|
+
"version": "^1.83.4",
|
|
48
|
+
"alwaysAddToPackageJson": true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
38
51
|
}
|
|
39
52
|
}
|
|
40
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "20.5.0-beta.
|
|
3
|
+
"version": "20.5.0-beta.5",
|
|
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,8 +51,9 @@
|
|
|
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-
|
|
54
|
+
"sass": "^1.85.0",
|
|
55
|
+
"sass-embedded": "^1.83.4",
|
|
56
|
+
"sass-loader": "^16.0.4",
|
|
56
57
|
"source-map-loader": "^5.0.0",
|
|
57
58
|
"style-loader": "^3.3.0",
|
|
58
59
|
"stylus": "^0.64.0",
|
|
@@ -65,8 +66,8 @@
|
|
|
65
66
|
"webpack-dev-server": "^5.0.4",
|
|
66
67
|
"webpack-node-externals": "^3.0.0",
|
|
67
68
|
"webpack-subresource-integrity": "^5.1.0",
|
|
68
|
-
"@nx/devkit": "20.5.0-beta.
|
|
69
|
-
"@nx/js": "20.5.0-beta.
|
|
69
|
+
"@nx/devkit": "20.5.0-beta.5",
|
|
70
|
+
"@nx/js": "20.5.0-beta.5"
|
|
70
71
|
},
|
|
71
72
|
"publishConfig": {
|
|
72
73
|
"access": "public"
|
|
@@ -16,6 +16,7 @@ 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',
|
|
19
20
|
optimization: typeof options.optimization !== 'object'
|
|
20
21
|
? {
|
|
21
22
|
scripts: options.optimization,
|
|
@@ -81,6 +81,7 @@ export interface WebpackExecutorOptions {
|
|
|
81
81
|
index?: string;
|
|
82
82
|
postcssConfig?: string;
|
|
83
83
|
scripts?: Array<ExtraEntryPointClass | string>;
|
|
84
|
+
sassImplementation?: 'sass' | 'sass-embedded';
|
|
84
85
|
stylePreprocessorOptions?: any;
|
|
85
86
|
styles?: Array<ExtraEntryPointClass | string>;
|
|
86
87
|
subresourceIntegrity?: boolean;
|
|
@@ -144,6 +144,12 @@
|
|
|
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
|
+
},
|
|
147
153
|
"optimization": {
|
|
148
154
|
"description": "Enables optimization of the build output.",
|
|
149
155
|
"oneOf": [
|
|
@@ -56,6 +56,8 @@ 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;
|
|
59
61
|
const includePaths = [];
|
|
60
62
|
if (options?.stylePreprocessorOptions?.includePaths?.length > 0) {
|
|
61
63
|
options.stylePreprocessorOptions.includePaths.forEach((includePath) => includePaths.push(path.resolve(options.root, includePath)));
|
|
@@ -97,11 +99,15 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
97
99
|
{
|
|
98
100
|
loader: require.resolve('sass-loader'),
|
|
99
101
|
options: {
|
|
100
|
-
|
|
102
|
+
api: 'modern-compiler',
|
|
103
|
+
implementation: options.sassImplementation === 'sass-embedded'
|
|
104
|
+
? require.resolve('sass-embedded')
|
|
105
|
+
: require.resolve('sass'),
|
|
101
106
|
sassOptions: {
|
|
102
107
|
fiber: false,
|
|
103
108
|
precision: 8,
|
|
104
109
|
includePaths,
|
|
110
|
+
...(sassOptions ?? {}),
|
|
105
111
|
},
|
|
106
112
|
},
|
|
107
113
|
},
|
|
@@ -117,6 +123,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
117
123
|
options: {
|
|
118
124
|
lessOptions: {
|
|
119
125
|
paths: includePaths,
|
|
126
|
+
...(lessOptions ?? {}),
|
|
120
127
|
},
|
|
121
128
|
},
|
|
122
129
|
},
|
|
@@ -152,13 +159,17 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
152
159
|
{
|
|
153
160
|
loader: require.resolve('sass-loader'),
|
|
154
161
|
options: {
|
|
155
|
-
|
|
162
|
+
api: 'modern-compiler',
|
|
163
|
+
implementation: options.sassImplementation === 'sass-embedded'
|
|
164
|
+
? require.resolve('sass-embedded')
|
|
165
|
+
: require.resolve('sass'),
|
|
156
166
|
sourceMap: !!options.sourceMap,
|
|
157
167
|
sassOptions: {
|
|
158
168
|
fiber: false,
|
|
159
169
|
// bootstrap-sass requires a minimum precision of 8
|
|
160
170
|
precision: 8,
|
|
161
171
|
includePaths,
|
|
172
|
+
...(sassOptions ?? {}),
|
|
162
173
|
},
|
|
163
174
|
},
|
|
164
175
|
},
|
|
@@ -176,6 +187,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
176
187
|
lessOptions: {
|
|
177
188
|
javascriptEnabled: true,
|
|
178
189
|
...lessPathOptions,
|
|
190
|
+
...(lessOptions ?? {}),
|
|
179
191
|
},
|
|
180
192
|
},
|
|
181
193
|
},
|
|
@@ -212,13 +224,17 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
212
224
|
{
|
|
213
225
|
loader: require.resolve('sass-loader'),
|
|
214
226
|
options: {
|
|
215
|
-
|
|
227
|
+
api: 'modern-compiler',
|
|
228
|
+
implementation: options.sassImplementation === 'sass-embedded'
|
|
229
|
+
? require.resolve('sass-embedded')
|
|
230
|
+
: require.resolve('sass'),
|
|
216
231
|
sourceMap: !!options.sourceMap,
|
|
217
232
|
sassOptions: {
|
|
218
233
|
fiber: false,
|
|
219
234
|
// bootstrap-sass requires a minimum precision of 8
|
|
220
235
|
precision: 8,
|
|
221
236
|
includePaths,
|
|
237
|
+
...(sassOptions ?? {}),
|
|
222
238
|
},
|
|
223
239
|
},
|
|
224
240
|
},
|
|
@@ -236,6 +252,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
236
252
|
lessOptions: {
|
|
237
253
|
javascriptEnabled: true,
|
|
238
254
|
...lessPathOptions,
|
|
255
|
+
...(lessOptions ?? {}),
|
|
239
256
|
},
|
|
240
257
|
},
|
|
241
258
|
},
|
|
@@ -85,6 +85,7 @@ function normalizeOptions(options) {
|
|
|
85
85
|
target: combinedPluginAndMaybeExecutorOptions.target,
|
|
86
86
|
targetName,
|
|
87
87
|
vendorChunk: combinedPluginAndMaybeExecutorOptions.vendorChunk ?? !isProd,
|
|
88
|
+
sassImplementation: combinedPluginAndMaybeExecutorOptions.sassImplementation ?? 'sass',
|
|
88
89
|
};
|
|
89
90
|
}
|
|
90
91
|
function normalizeAssets(assets, root, sourceRoot, projectRoot, resolveRelativePathsToProjectRoot = true) {
|
|
@@ -185,7 +185,11 @@ export interface NxAppWebpackPluginOptions {
|
|
|
185
185
|
/**
|
|
186
186
|
* Options for the style preprocessor. e.g. `{ "includePaths": [] }` for SASS.
|
|
187
187
|
*/
|
|
188
|
-
stylePreprocessorOptions?:
|
|
188
|
+
stylePreprocessorOptions?: {
|
|
189
|
+
includePaths?: string[];
|
|
190
|
+
sassOptions?: Record<string, any>;
|
|
191
|
+
lessOptions?: Record<string, any>;
|
|
192
|
+
};
|
|
189
193
|
/**
|
|
190
194
|
* External stylesheets that will be included with the application.
|
|
191
195
|
*/
|
|
@@ -206,6 +210,10 @@ export interface NxAppWebpackPluginOptions {
|
|
|
206
210
|
* Use tsconfig-paths-webpack-plugin to resolve modules using paths in the tsconfig file.
|
|
207
211
|
*/
|
|
208
212
|
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';
|
|
209
217
|
/**
|
|
210
218
|
* Generate a separate vendor chunk for 3rd party packages.
|
|
211
219
|
*/
|
package/src/utils/with-web.d.ts
CHANGED
|
@@ -8,8 +8,13 @@ export interface WithWebOptions {
|
|
|
8
8
|
generateIndexHtml?: boolean;
|
|
9
9
|
index?: string;
|
|
10
10
|
postcssConfig?: string;
|
|
11
|
+
sassImplementation?: 'sass' | 'sass-embedded';
|
|
11
12
|
scripts?: Array<ExtraEntryPointClass | string>;
|
|
12
|
-
stylePreprocessorOptions?:
|
|
13
|
+
stylePreprocessorOptions?: {
|
|
14
|
+
includePaths?: string[];
|
|
15
|
+
sassOptions?: Record<string, any>;
|
|
16
|
+
lessOptions?: Record<string, any>;
|
|
17
|
+
};
|
|
13
18
|
styles?: Array<ExtraEntryPointClass | string>;
|
|
14
19
|
subresourceIntegrity?: boolean;
|
|
15
20
|
ssr?: boolean;
|