@angular-devkit/build-webpack 0.1902.0-next.2 → 0.1902.0
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
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@angular-devkit/build-webpack",
|
3
|
-
"version": "0.1902.0
|
3
|
+
"version": "0.1902.0",
|
4
4
|
"description": "Webpack Builder for Architect",
|
5
5
|
"experimental": true,
|
6
6
|
"main": "src/index.js",
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"./*.js": "./*.js"
|
17
17
|
},
|
18
18
|
"dependencies": {
|
19
|
-
"@angular-devkit/architect": "0.1902.0
|
19
|
+
"@angular-devkit/architect": "0.1902.0",
|
20
20
|
"rxjs": "7.8.1"
|
21
21
|
},
|
22
22
|
"peerDependencies": {
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
13
13
|
exports.runWebpack = runWebpack;
|
14
14
|
const architect_1 = require("@angular-devkit/architect");
|
15
|
-
const
|
15
|
+
const node_path_1 = require("node:path");
|
16
16
|
const rxjs_1 = require("rxjs");
|
17
17
|
const webpack_1 = __importDefault(require("webpack"));
|
18
18
|
const utils_1 = require("../../utils");
|
@@ -87,7 +87,7 @@ function runWebpack(config, context, options = {}) {
|
|
87
87
|
})));
|
88
88
|
}
|
89
89
|
const builder = (0, architect_1.createBuilder)((options, context) => {
|
90
|
-
const configPath = (0,
|
90
|
+
const configPath = (0, node_path_1.resolve)(context.workspaceRoot, options.webpackConfig);
|
91
91
|
return (0, rxjs_1.from)((0, utils_1.getWebpackConfig)(configPath)).pipe((0, rxjs_1.switchMap)((config) => runWebpack(config, context)));
|
92
92
|
});
|
93
93
|
exports.default = builder;
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
13
13
|
exports.runWebpackDevServer = runWebpackDevServer;
|
14
14
|
const architect_1 = require("@angular-devkit/architect");
|
15
|
-
const
|
15
|
+
const node_path_1 = require("node:path");
|
16
16
|
const rxjs_1 = require("rxjs");
|
17
17
|
const webpack_1 = __importDefault(require("webpack"));
|
18
18
|
const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
|
@@ -86,7 +86,7 @@ function runWebpackDevServer(config, context, options = {}) {
|
|
86
86
|
})));
|
87
87
|
}
|
88
88
|
const builder = (0, architect_1.createBuilder)((options, context) => {
|
89
|
-
const configPath = (0,
|
89
|
+
const configPath = (0, node_path_1.resolve)(context.workspaceRoot, options.webpackConfig);
|
90
90
|
return (0, rxjs_1.from)((0, utils_1.getWebpackConfig)(configPath)).pipe((0, rxjs_1.switchMap)((config) => runWebpackDevServer(config, context)));
|
91
91
|
});
|
92
92
|
exports.default = builder;
|
package/src/utils.js
CHANGED
@@ -42,9 +42,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
43
43
|
exports.getEmittedFiles = getEmittedFiles;
|
44
44
|
exports.getWebpackConfig = getWebpackConfig;
|
45
|
-
const
|
46
|
-
const path = __importStar(require("path"));
|
47
|
-
const
|
45
|
+
const node_fs_1 = require("node:fs");
|
46
|
+
const path = __importStar(require("node:path"));
|
47
|
+
const node_url_1 = require("node:url");
|
48
48
|
function getEmittedFiles(compilation) {
|
49
49
|
const files = [];
|
50
50
|
const chunkFileNames = new Set();
|
@@ -90,7 +90,7 @@ function loadEsmModule(modulePath) {
|
|
90
90
|
return new Function('modulePath', `return import(modulePath);`)(modulePath);
|
91
91
|
}
|
92
92
|
async function getWebpackConfig(configPath) {
|
93
|
-
if (!(0,
|
93
|
+
if (!(0, node_fs_1.existsSync)(configPath)) {
|
94
94
|
throw new Error(`Webpack configuration file ${configPath} does not exist.`);
|
95
95
|
}
|
96
96
|
switch (path.extname(configPath)) {
|
@@ -98,7 +98,7 @@ async function getWebpackConfig(configPath) {
|
|
98
98
|
// Load the ESM configuration file using the TypeScript dynamic import workaround.
|
99
99
|
// Once TypeScript provides support for keeping the dynamic import this workaround can be
|
100
100
|
// changed to a direct dynamic import.
|
101
|
-
return (await loadEsmModule((0,
|
101
|
+
return (await loadEsmModule((0, node_url_1.pathToFileURL)(configPath))).default;
|
102
102
|
case '.cjs':
|
103
103
|
return require(configPath);
|
104
104
|
default:
|
@@ -112,7 +112,7 @@ async function getWebpackConfig(configPath) {
|
|
112
112
|
// Load the ESM configuration file using the TypeScript dynamic import workaround.
|
113
113
|
// Once TypeScript provides support for keeping the dynamic import this workaround can be
|
114
114
|
// changed to a direct dynamic import.
|
115
|
-
return (await loadEsmModule((0,
|
115
|
+
return (await loadEsmModule((0, node_url_1.pathToFileURL)(configPath)))
|
116
116
|
.default;
|
117
117
|
}
|
118
118
|
throw e;
|