@nx/webpack 16.4.0-beta.8 → 16.4.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": "@nx/webpack",
|
|
3
|
-
"version": "16.4.0
|
|
3
|
+
"version": "16.4.0",
|
|
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": {
|
|
@@ -30,11 +30,12 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@babel/core": "^7.15.0",
|
|
33
|
-
"@nrwl/webpack": "16.4.0
|
|
34
|
-
"@nx/devkit": "16.4.0
|
|
35
|
-
"@nx/js": "16.4.0
|
|
33
|
+
"@nrwl/webpack": "16.4.0",
|
|
34
|
+
"@nx/devkit": "16.4.0",
|
|
35
|
+
"@nx/js": "16.4.0",
|
|
36
36
|
"autoprefixer": "^10.4.9",
|
|
37
37
|
"babel-loader": "^9.1.2",
|
|
38
|
+
"browserslist": "^4.21.4",
|
|
38
39
|
"chalk": "^4.1.0",
|
|
39
40
|
"chokidar": "^3.5.1",
|
|
40
41
|
"copy-webpack-plugin": "^10.2.4",
|
|
@@ -75,5 +76,5 @@
|
|
|
75
76
|
"access": "public"
|
|
76
77
|
},
|
|
77
78
|
"types": "./index.d.ts",
|
|
78
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "ae698a72748d9f33aa5395aeeaa7b7af436a1dc5"
|
|
79
80
|
}
|
|
@@ -21,27 +21,22 @@ function ssrDevServerExecutor(options, context) {
|
|
|
21
21
|
const combined = (0, async_iterable_1.combineAsyncIterables)(runBrowser, runServer);
|
|
22
22
|
process.env['port'] = `${options.port}`;
|
|
23
23
|
try {
|
|
24
|
-
for (var _f = true, combined_1 = tslib_1.__asyncValues(combined), combined_1_1; combined_1_1 = yield tslib_1.__await(combined_1.next()), _c = combined_1_1.done, !_c;) {
|
|
24
|
+
for (var _f = true, combined_1 = tslib_1.__asyncValues(combined), combined_1_1; combined_1_1 = yield tslib_1.__await(combined_1.next()), _c = combined_1_1.done, !_c; _f = true) {
|
|
25
25
|
_e = combined_1_1.value;
|
|
26
26
|
_f = false;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
nodeStarted = true;
|
|
33
|
-
}
|
|
34
|
-
else if (((_b = output.options) === null || _b === void 0 ? void 0 : _b.target) === 'web') {
|
|
35
|
-
browserBuilt = true;
|
|
36
|
-
}
|
|
37
|
-
if (nodeStarted && browserBuilt) {
|
|
38
|
-
yield tslib_1.__await((0, wait_until_server_is_listening_1.waitUntilServerIsListening)(options.port));
|
|
39
|
-
console.log(`[ ${chalk.green('ready')} ] on http://localhost:${options.port}`);
|
|
40
|
-
yield yield tslib_1.__await(Object.assign(Object.assign({}, output), { baseUrl: `http://localhost:${options.port}` }));
|
|
41
|
-
}
|
|
27
|
+
const output = _e;
|
|
28
|
+
if (!output.success)
|
|
29
|
+
throw new Error('Could not build application');
|
|
30
|
+
if (((_a = output.options) === null || _a === void 0 ? void 0 : _a.target) === 'node') {
|
|
31
|
+
nodeStarted = true;
|
|
42
32
|
}
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
else if (((_b = output.options) === null || _b === void 0 ? void 0 : _b.target) === 'web') {
|
|
34
|
+
browserBuilt = true;
|
|
35
|
+
}
|
|
36
|
+
if (nodeStarted && browserBuilt) {
|
|
37
|
+
yield tslib_1.__await((0, wait_until_server_is_listening_1.waitUntilServerIsListening)(options.port));
|
|
38
|
+
console.log(`[ ${chalk.green('ready')} ] on http://localhost:${options.port}`);
|
|
39
|
+
yield yield tslib_1.__await(Object.assign(Object.assign({}, output), { baseUrl: `http://localhost:${options.port}` }));
|
|
45
40
|
}
|
|
46
41
|
}
|
|
47
42
|
}
|
|
@@ -12,15 +12,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
module.exports = require('babel-loader').custom(() => {
|
|
13
13
|
return {
|
|
14
14
|
customOptions(_a) {
|
|
15
|
-
var { isModern, emitDecoratorMetadata } = _a, loader = __rest(_a, ["isModern", "emitDecoratorMetadata"]);
|
|
15
|
+
var { isTest, isModern, emitDecoratorMetadata } = _a, loader = __rest(_a, ["isTest", "isModern", "emitDecoratorMetadata"]);
|
|
16
16
|
return {
|
|
17
|
-
custom: { isModern, emitDecoratorMetadata },
|
|
17
|
+
custom: { isTest, isModern, emitDecoratorMetadata },
|
|
18
18
|
loader,
|
|
19
19
|
};
|
|
20
20
|
},
|
|
21
|
-
config(cfg, { customOptions: { isModern, emitDecoratorMetadata } }) {
|
|
21
|
+
config(cfg, { customOptions: { isTest, isModern, emitDecoratorMetadata } }) {
|
|
22
22
|
// Add hint to our babel preset so it can handle modern vs legacy bundles.
|
|
23
23
|
cfg.options.caller.isModern = isModern;
|
|
24
|
+
cfg.options.caller.isTest = isTest;
|
|
24
25
|
cfg.options.caller.emitDecoratorMetadata = emitDecoratorMetadata;
|
|
25
26
|
return cfg.options;
|
|
26
27
|
},
|
package/src/utils/with-nx.d.ts
CHANGED
package/src/utils/with-nx.js
CHANGED
|
@@ -2,23 +2,43 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createLoaderFromCompiler = exports.withNx = void 0;
|
|
4
4
|
const path = require("path");
|
|
5
|
+
const path_1 = require("path");
|
|
5
6
|
const webpack_1 = require("webpack");
|
|
6
7
|
const tsconfig_paths_webpack_plugin_1 = require("tsconfig-paths-webpack-plugin");
|
|
7
8
|
const js_1 = require("@nx/js");
|
|
8
9
|
const license_webpack_plugin_1 = require("license-webpack-plugin");
|
|
9
|
-
const TerserPlugin = require("terser-webpack-plugin");
|
|
10
|
-
const nodeExternals = require("webpack-node-externals");
|
|
11
|
-
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
|
|
12
10
|
const stats_json_plugin_1 = require("../plugins/stats-json-plugin");
|
|
13
11
|
const create_copy_plugin_1 = require("./create-copy-plugin");
|
|
14
12
|
const generate_package_json_plugin_1 = require("../plugins/generate-package-json-plugin");
|
|
15
13
|
const hash_format_1 = require("./hash-format");
|
|
14
|
+
const fs_1 = require("fs");
|
|
15
|
+
const TerserPlugin = require("terser-webpack-plugin");
|
|
16
|
+
const nodeExternals = require("webpack-node-externals");
|
|
17
|
+
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
|
|
18
|
+
const browserslist = require("browserslist");
|
|
19
|
+
const VALID_BROWSERSLIST_FILES = ['.browserslistrc', 'browserslist'];
|
|
20
|
+
function getTerserEcmaVersion(projectRoot) {
|
|
21
|
+
let pathToBrowserslistFile = '';
|
|
22
|
+
for (const browserslistFile of VALID_BROWSERSLIST_FILES) {
|
|
23
|
+
const fullPathToFile = (0, path_1.join)(projectRoot, browserslistFile);
|
|
24
|
+
if ((0, fs_1.existsSync)(fullPathToFile)) {
|
|
25
|
+
pathToBrowserslistFile = fullPathToFile;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (!pathToBrowserslistFile) {
|
|
30
|
+
return 2020;
|
|
31
|
+
}
|
|
32
|
+
const env = browserslist.loadConfig({ path: pathToBrowserslistFile });
|
|
33
|
+
const browsers = browserslist(env);
|
|
34
|
+
return browsers.includes('ie 11') ? 5 : 2020;
|
|
35
|
+
}
|
|
16
36
|
const IGNORED_WEBPACK_WARNINGS = [
|
|
17
37
|
/The comment file/i,
|
|
18
38
|
/could not find any license/i,
|
|
19
39
|
];
|
|
20
40
|
const extensions = ['.ts', '.tsx', '.mjs', '.js', '.jsx'];
|
|
21
|
-
const mainFields = ['
|
|
41
|
+
const mainFields = ['module', 'main'];
|
|
22
42
|
const processed = new Set();
|
|
23
43
|
/**
|
|
24
44
|
* @param {WithNxOptions} pluginOptions
|
|
@@ -143,7 +163,7 @@ function withNx(pluginOptions) {
|
|
|
143
163
|
parallel: true,
|
|
144
164
|
terserOptions: {
|
|
145
165
|
keep_classnames: true,
|
|
146
|
-
ecma:
|
|
166
|
+
ecma: getTerserEcmaVersion((0, path_1.join)(options.root, options.projectRoot)),
|
|
147
167
|
safari10: true,
|
|
148
168
|
format: {
|
|
149
169
|
ascii_only: true,
|
|
@@ -267,6 +287,7 @@ function createLoaderFromCompiler(options) {
|
|
|
267
287
|
cwd: path.join(options.root, options.sourceRoot),
|
|
268
288
|
emitDecoratorMetadata: tsConfig.options.emitDecoratorMetadata,
|
|
269
289
|
isModern: true,
|
|
290
|
+
isTest: process.env.NX_CYPRESS_COMPONENT_TEST === 'true',
|
|
270
291
|
envName: (_a = process.env.BABEL_ENV) !== null && _a !== void 0 ? _a : process.env.NODE_ENV,
|
|
271
292
|
cacheDirectory: true,
|
|
272
293
|
cacheCompression: false,
|