@cypress/webpack-dev-server 4.0.2 → 4.1.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/README.md +4 -0
- package/dist/createWebpackDevServer.js +9 -8
- package/dist/makeDefaultWebpackConfig.js +6 -0
- package/dist/util.d.ts +2 -0
- package/dist/util.js +10 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -39,6 +39,10 @@ export default defineConfig({
|
|
|
39
39
|
})
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
## Debugging
|
|
43
|
+
|
|
44
|
+
If having issues with chunk load errors or bundle size problems, specifically in your component tests, please try setting `DEBUG=cypress-verbose:webpack-dev-server:bundle-analyzer` before starting Cypress to get a `webpack-bundle-analyzer` report to help determine the cause of the issue. If filing an issue with Cypress, please include this report with your issue to better help us serve your issue.
|
|
45
|
+
|
|
42
46
|
## Testing
|
|
43
47
|
|
|
44
48
|
Unit tests can be run with `yarn test`. Integration tests can be run with `yarn cypress:run`
|
|
@@ -4,6 +4,7 @@ exports.createWebpackDevServer = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
6
6
|
const makeWebpackConfig_1 = require("./makeWebpackConfig");
|
|
7
|
+
const util_1 = require("./util");
|
|
7
8
|
const debug = (0, debug_1.default)('cypress:webpack-dev-server:start');
|
|
8
9
|
async function createWebpackDevServer(config) {
|
|
9
10
|
const { sourceWebpackModulesResult: { webpack: { module: webpack, }, webpackDevServer: { majorVersion: webpackDevServerMajorVersion, }, }, } = config;
|
|
@@ -25,10 +26,10 @@ function webpackDevServer5(config, compiler, finalWebpackConfig) {
|
|
|
25
26
|
const { devServerConfig: { cypressConfig: { devServerPublicPathRoute } } } = config;
|
|
26
27
|
const isOpenMode = !config.devServerConfig.cypressConfig.isTextTerminal;
|
|
27
28
|
const WebpackDevServer = config.sourceWebpackModulesResult.webpackDevServer.module;
|
|
28
|
-
const webpackDevServerConfig = Object.assign(Object.assign({ host: '127.0.0.1', port: 'auto' }, finalWebpackConfig === null || finalWebpackConfig === void 0 ? void 0 : finalWebpackConfig.devServer), { devMiddleware: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}, hot: false,
|
|
29
|
+
const webpackDevServerConfig = Object.assign(Object.assign({ host: '127.0.0.1', port: 'auto' }, finalWebpackConfig === null || finalWebpackConfig === void 0 ? void 0 : finalWebpackConfig.devServer), { devMiddleware: Object.assign({ publicPath: devServerPublicPathRoute, stats: (_a = finalWebpackConfig.stats) !== null && _a !== void 0 ? _a : 'minimal' }, ((0, util_1.isWebpackBundleAnalyzerEnabled)() ? {
|
|
30
|
+
// the bundle needs to be written to disk in order to determine source map sizes
|
|
31
|
+
writeToDisk: true,
|
|
32
|
+
} : {})), hot: false,
|
|
32
33
|
// Only enable file watching & reload when executing tests in `open` mode
|
|
33
34
|
liveReload: isOpenMode });
|
|
34
35
|
debug(WebpackDevServer);
|
|
@@ -45,10 +46,10 @@ function webpackDevServer4(config, compiler, finalWebpackConfig) {
|
|
|
45
46
|
const { devServerConfig: { cypressConfig: { devServerPublicPathRoute } } } = config;
|
|
46
47
|
const isOpenMode = !config.devServerConfig.cypressConfig.isTextTerminal;
|
|
47
48
|
const WebpackDevServer = config.sourceWebpackModulesResult.webpackDevServer.module;
|
|
48
|
-
const webpackDevServerConfig = Object.assign(Object.assign({ host: '127.0.0.1', port: 'auto' }, finalWebpackConfig === null || finalWebpackConfig === void 0 ? void 0 : finalWebpackConfig.devServer), { devMiddleware: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, hot: false,
|
|
49
|
+
const webpackDevServerConfig = Object.assign(Object.assign({ host: '127.0.0.1', port: 'auto' }, finalWebpackConfig === null || finalWebpackConfig === void 0 ? void 0 : finalWebpackConfig.devServer), { devMiddleware: Object.assign({ publicPath: devServerPublicPathRoute, stats: (_a = finalWebpackConfig.stats) !== null && _a !== void 0 ? _a : 'minimal' }, ((0, util_1.isWebpackBundleAnalyzerEnabled)() ? {
|
|
50
|
+
// the bundle needs to be written to disk in order to determine source map sizes
|
|
51
|
+
writeToDisk: true,
|
|
52
|
+
} : {})), hot: false,
|
|
52
53
|
// Only enable file watching & reload when executing tests in `open` mode
|
|
53
54
|
liveReload: isOpenMode });
|
|
54
55
|
const server = new WebpackDevServer(webpackDevServerConfig, compiler);
|
|
@@ -5,6 +5,8 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
6
|
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
7
7
|
const CypressCTWebpackPlugin_1 = require("./CypressCTWebpackPlugin");
|
|
8
|
+
const util_1 = require("./util");
|
|
9
|
+
const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
|
|
8
10
|
const debug = (0, debug_1.default)('cypress:webpack-dev-server:makeDefaultWebpackConfig');
|
|
9
11
|
const OUTPUT_PATH = path_1.default.join(__dirname, 'dist');
|
|
10
12
|
const OsSeparatorRE = RegExp(`\\${path_1.default.sep}`, 'g');
|
|
@@ -52,9 +54,13 @@ function makeCypressWebpackConfig(config) {
|
|
|
52
54
|
webpack,
|
|
53
55
|
indexHtmlFile,
|
|
54
56
|
}),
|
|
57
|
+
...((0, util_1.isWebpackBundleAnalyzerEnabled)() ? [new webpack_bundle_analyzer_1.BundleAnalyzerPlugin()] : []),
|
|
55
58
|
],
|
|
56
59
|
devtool: 'inline-source-map',
|
|
57
60
|
};
|
|
61
|
+
if ((0, util_1.isWebpackBundleAnalyzerEnabled)()) {
|
|
62
|
+
(0, debug_1.default)(util_1.WBADebugNamespace)('webpack-bundle-analyzer is enabled.');
|
|
63
|
+
}
|
|
58
64
|
if (isRunMode) {
|
|
59
65
|
// if justInTimeCompile is configured, we need to watch for file changes as the spec entries are going to be updated per test
|
|
60
66
|
const ignored = justInTimeCompile ? /node_modules/ : '**/*';
|
package/dist/util.d.ts
ADDED
package/dist/util.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isWebpackBundleAnalyzerEnabled = exports.WBADebugNamespace = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
6
|
+
exports.WBADebugNamespace = 'cypress-verbose:webpack-dev-server:bundle-analyzer';
|
|
7
|
+
const isWebpackBundleAnalyzerEnabled = () => {
|
|
8
|
+
return debug_1.default.enabled(exports.WBADebugNamespace);
|
|
9
|
+
};
|
|
10
|
+
exports.isWebpackBundleAnalyzerEnabled = isWebpackBundleAnalyzerEnabled;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cypress/webpack-dev-server",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Launches Webpack Dev Server for Component Testing",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"semver": "^7.7.1",
|
|
26
26
|
"speed-measure-webpack-plugin": "1.4.2",
|
|
27
27
|
"tslib": "^2.3.1",
|
|
28
|
+
"webpack-bundle-analyzer": "4.10.2",
|
|
28
29
|
"webpack-dev-server": "^5.1.0",
|
|
29
30
|
"webpack-merge": "^5.4.0"
|
|
30
31
|
},
|
|
@@ -32,12 +33,13 @@
|
|
|
32
33
|
"@types/node": "20.16.0",
|
|
33
34
|
"@types/proxyquire": "^1.3.28",
|
|
34
35
|
"@types/speed-measure-webpack-plugin": "^1.3.4",
|
|
36
|
+
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
35
37
|
"chai": "^4.3.6",
|
|
36
38
|
"dedent": "^0.7.0",
|
|
37
39
|
"mocha": "^9.2.2",
|
|
38
40
|
"proxyquire": "2.1.3",
|
|
39
41
|
"sinon": "^13.0.1",
|
|
40
|
-
"snap-shot-it": "^7.9.
|
|
42
|
+
"snap-shot-it": "^7.9.10",
|
|
41
43
|
"ts-node": "^10.9.2",
|
|
42
44
|
"webpack": "npm:webpack@^5",
|
|
43
45
|
"webpack-4": "npm:webpack@^4",
|