@nx/webpack 18.0.4 → 18.1.0-beta.1
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/package.json +4 -4
- package/src/executors/webpack/lib/normalize-options.js +1 -1
- package/src/plugins/nx-webpack-plugin/lib/normalize-options.d.ts +1 -1
- package/src/plugins/nx-webpack-plugin/lib/normalize-options.js +7 -3
- package/src/utils/webpack/plugins/postcss-cli-resources.js +2 -2
- package/src/utils/with-nx.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/webpack",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.1.0-beta.1",
|
|
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": {
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"webpack-dev-server": "^4.9.3",
|
|
64
64
|
"webpack-node-externals": "^3.0.0",
|
|
65
65
|
"webpack-subresource-integrity": "^5.1.0",
|
|
66
|
-
"@nx/devkit": "18.0.
|
|
67
|
-
"@nx/js": "18.0.
|
|
68
|
-
"@nrwl/webpack": "18.0.
|
|
66
|
+
"@nx/devkit": "18.1.0-beta.1",
|
|
67
|
+
"@nx/js": "18.1.0-beta.1",
|
|
68
|
+
"@nrwl/webpack": "18.1.0-beta.1"
|
|
69
69
|
},
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
@@ -21,7 +21,7 @@ function normalizeOptions(options, root, projectRoot, sourceRoot) {
|
|
|
21
21
|
: options.optimization,
|
|
22
22
|
};
|
|
23
23
|
if (options.assets) {
|
|
24
|
-
normalizedOptions.assets = (0, normalize_options_1.normalizeAssets)(options.assets, root, sourceRoot);
|
|
24
|
+
normalizedOptions.assets = (0, normalize_options_1.normalizeAssets)(options.assets, root, sourceRoot, projectRoot);
|
|
25
25
|
}
|
|
26
26
|
return normalizedOptions;
|
|
27
27
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AssetGlobPattern, FileReplacement, NormalizedNxWebpackPluginOptions, NxWebpackPluginOptions } from '../nx-webpack-plugin-options';
|
|
2
2
|
export declare function normalizeOptions(options: NxWebpackPluginOptions): NormalizedNxWebpackPluginOptions;
|
|
3
|
-
export declare function normalizeAssets(assets: any[], root: string, sourceRoot: string): AssetGlobPattern[];
|
|
3
|
+
export declare function normalizeAssets(assets: any[], root: string, sourceRoot: string, projectRoot: string): AssetGlobPattern[];
|
|
4
4
|
export declare function normalizeFileReplacements(root: string, fileReplacements: FileReplacement[]): FileReplacement[];
|
|
@@ -40,7 +40,7 @@ function normalizeOptions(options) {
|
|
|
40
40
|
return {
|
|
41
41
|
...options,
|
|
42
42
|
assets: options.assets
|
|
43
|
-
? normalizeAssets(options.assets, devkit_1.workspaceRoot, sourceRoot)
|
|
43
|
+
? normalizeAssets(options.assets, devkit_1.workspaceRoot, sourceRoot, projectNode.data.root)
|
|
44
44
|
: [],
|
|
45
45
|
baseHref: options.baseHref ?? '/',
|
|
46
46
|
commonChunk: options.commonChunk ?? true,
|
|
@@ -71,7 +71,7 @@ function normalizeOptions(options) {
|
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
exports.normalizeOptions = normalizeOptions;
|
|
74
|
-
function normalizeAssets(assets, root, sourceRoot) {
|
|
74
|
+
function normalizeAssets(assets, root, sourceRoot, projectRoot) {
|
|
75
75
|
return assets.map((asset) => {
|
|
76
76
|
if (typeof asset === 'string') {
|
|
77
77
|
const assetPath = (0, devkit_1.normalizePath)(asset);
|
|
@@ -97,7 +97,11 @@ function normalizeAssets(assets, root, sourceRoot) {
|
|
|
97
97
|
throw new Error('An asset cannot be written to a location outside of the output path.');
|
|
98
98
|
}
|
|
99
99
|
const assetPath = (0, devkit_1.normalizePath)(asset.input);
|
|
100
|
-
|
|
100
|
+
let resolvedAssetPath = (0, path_1.resolve)(root, assetPath);
|
|
101
|
+
if (asset.input.startsWith('.')) {
|
|
102
|
+
const resolvedProjectRoot = (0, path_1.resolve)(root, projectRoot);
|
|
103
|
+
resolvedAssetPath = (0, path_1.resolve)(resolvedProjectRoot, assetPath);
|
|
104
|
+
}
|
|
101
105
|
return {
|
|
102
106
|
...asset,
|
|
103
107
|
input: resolvedAssetPath,
|
|
@@ -122,7 +122,7 @@ function PostcssCliResources(options) {
|
|
|
122
122
|
const resourceCache = new Map();
|
|
123
123
|
return Promise.all(urlDeclarations.map(async (decl) => {
|
|
124
124
|
const value = decl.value;
|
|
125
|
-
const urlRegex = /url(?:\(\s*['"]?)(.*?)(
|
|
125
|
+
const urlRegex = /url(?:\(\s*(['"]?))(.*?)(?:\1\s*\))/g;
|
|
126
126
|
const segments = [];
|
|
127
127
|
let match;
|
|
128
128
|
let lastIndex = 0;
|
|
@@ -131,7 +131,7 @@ function PostcssCliResources(options) {
|
|
|
131
131
|
const inputFile = decl.source && decl.source.input.file;
|
|
132
132
|
const context = (inputFile && path.dirname(inputFile)) || loader.context;
|
|
133
133
|
while ((match = urlRegex.exec(value))) {
|
|
134
|
-
const originalUrl = match[
|
|
134
|
+
const originalUrl = match[2];
|
|
135
135
|
let processedUrl;
|
|
136
136
|
try {
|
|
137
137
|
processedUrl = await process(originalUrl, context, resourceCache);
|
package/src/utils/with-nx.js
CHANGED
|
@@ -19,7 +19,7 @@ function withNx(pluginOptions = {}) {
|
|
|
19
19
|
assets: options.assets
|
|
20
20
|
? options.assets
|
|
21
21
|
: pluginOptions.assets
|
|
22
|
-
? (0, normalize_options_1.normalizeAssets)(pluginOptions.assets, options.root, options.sourceRoot)
|
|
22
|
+
? (0, normalize_options_1.normalizeAssets)(pluginOptions.assets, options.root, options.sourceRoot, options.projectRoot)
|
|
23
23
|
: [],
|
|
24
24
|
root: context.root,
|
|
25
25
|
projectName: context.projectName,
|