@angular-devkit/build-webpack 0.2000.0-rc.2 → 0.2000.0-rc.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/utils.js +9 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-devkit/build-webpack",
3
- "version": "0.2000.0-rc.2",
3
+ "version": "0.2000.0-rc.3",
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.2000.0-rc.2",
19
+ "@angular-devkit/architect": "0.2000.0-rc.3",
20
20
  "rxjs": "7.8.2"
21
21
  },
22
22
  "peerDependencies": {
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "packageManager": "pnpm@9.15.9",
38
38
  "engines": {
39
- "node": "^20.11.1 || ^22.11.0 || >=24.0.0",
39
+ "node": "^20.19.0 || ^22.12.0 || >=24.0.0",
40
40
  "npm": "^6.11.0 || ^7.5.6 || >=8.0.0",
41
41
  "yarn": ">= 1.13.0"
42
42
  },
package/src/utils.js CHANGED
@@ -93,19 +93,23 @@ async function getWebpackConfig(configPath) {
93
93
  if (!(0, node_fs_1.existsSync)(configPath)) {
94
94
  throw new Error(`Webpack configuration file ${configPath} does not exist.`);
95
95
  }
96
+ let config;
96
97
  switch (path.extname(configPath)) {
97
98
  case '.mjs':
98
99
  // Load the ESM configuration file using the TypeScript dynamic import workaround.
99
100
  // Once TypeScript provides support for keeping the dynamic import this workaround can be
100
101
  // changed to a direct dynamic import.
101
- return (await loadEsmModule((0, node_url_1.pathToFileURL)(configPath))).default;
102
+ config = await loadEsmModule((0, node_url_1.pathToFileURL)(configPath));
103
+ break;
102
104
  case '.cjs':
103
- return require(configPath);
105
+ config = require(configPath);
106
+ break;
104
107
  default:
105
108
  // The file could be either CommonJS or ESM.
106
109
  // CommonJS is tried first then ESM if loading fails.
107
110
  try {
108
- return require(configPath);
111
+ config = require(configPath);
112
+ break;
109
113
  }
110
114
  catch (e) {
111
115
  if (e.code === 'ERR_REQUIRE_ESM' ||
@@ -113,10 +117,10 @@ async function getWebpackConfig(configPath) {
113
117
  // Load the ESM configuration file using the TypeScript dynamic import workaround.
114
118
  // Once TypeScript provides support for keeping the dynamic import this workaround can be
115
119
  // changed to a direct dynamic import.
116
- return (await loadEsmModule((0, node_url_1.pathToFileURL)(configPath)))
117
- .default;
120
+ config = await loadEsmModule((0, node_url_1.pathToFileURL)(configPath));
118
121
  }
119
122
  throw e;
120
123
  }
121
124
  }
125
+ return 'default' in config ? config.default : config;
122
126
  }