@cypress/webpack-dev-server 2.0.0 → 2.3.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 CHANGED
@@ -2,7 +2,9 @@
2
2
 
3
3
  Implements the APIs for the object-syntax of the Cypress Component-testing "webpack dev server".
4
4
 
5
- Object syntax:
5
+ > **Note:** This package is bundled with the Cypress binary and should not need to be installed separately. See the [Component Framework Configuration Docs](https://docs.cypress.io/guides/component-testing/component-framework-configuration) for setting up component testing with webpack. The `devServer` function signature is for advanced use-cases.
6
+
7
+ Object API:
6
8
 
7
9
  ```ts
8
10
  import { defineConfig } from 'cypress'
@@ -18,7 +20,7 @@ export default defineConfig({
18
20
  })
19
21
  ```
20
22
 
21
- Function syntax:
23
+ Function API:
22
24
 
23
25
  ```ts
24
26
  import { devServer } from '@cypress/webpack-dev-server'
@@ -26,10 +28,10 @@ import { defineConfig } from 'cypress'
26
28
 
27
29
  export default defineConfig({
28
30
  component: {
29
- devServer(cypressConfig) {
31
+ devServer(devServerConfig) {
30
32
  return devServer({
31
- cypressConfig,
32
- framework: 'react',
33
+ ...devServerConfig,
34
+ framework: 'create-react-app',
33
35
  webpackConfig: require('./webpack.config.js')
34
36
  })
35
37
  }
@@ -39,7 +41,7 @@ export default defineConfig({
39
41
 
40
42
  ## Testing
41
43
 
42
- Unit tests can be run with `npm test`. Integration tests can be run with `yarn cypress:run`
44
+ Unit tests can be run with `yarn test`. Integration tests can be run with `yarn cypress:run`
43
45
 
44
46
  This module should be primarily covered by system-tests / open-mode tests. All system-tests directories should be created using the notation:
45
47
 
@@ -60,6 +62,17 @@ From there, we check the "framework" field to source or define any known webpack
60
62
 
61
63
  We then merge the sourced config with the user's webpack config, and layer on our own transforms, and provide this to a webpack instance. The webpack instance used to create a webpack-dev-server, which is returned.
62
64
 
63
- ## Changelog
65
+ ## Compatibility
66
+
67
+ | @cypress/webpack-dev-server | cypress |
68
+ | --------------------------- | ------- |
69
+ | <= v1 | <= v9 |
70
+ | >= v2 | >= v10 |
71
+
72
+ ## License
73
+
74
+ [![license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/cypress-io/cypress/blob/master/LICENSE)
75
+
76
+ This project is licensed under the terms of the [MIT license](/LICENSE).
64
77
 
65
- [Changelog](./CHANGELOG.md)
78
+ ## [Changelog](./CHANGELOG.md)
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CypressCTWebpackPlugin = exports.normalizeError = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
6
- const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
7
- const path_1 = (0, tslib_1.__importDefault)(require("path"));
5
+ const lodash_1 = tslib_1.__importDefault(require("lodash"));
6
+ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
8
  const normalizeError = (error) => {
9
9
  return typeof error === 'string' ? error : error.message;
10
10
  };
@@ -51,13 +51,15 @@ class CypressCTWebpackPlugin {
51
51
  * has been "updated on disk", causing a recompliation (and pulling the new specs in as
52
52
  * dependencies).
53
53
  */
54
- this.onSpecsChange = (specs) => {
54
+ this.onSpecsChange = async (specs) => {
55
55
  var _a;
56
56
  if (!this.compilation || lodash_1.default.isEqual(specs, this.files)) {
57
57
  return;
58
58
  }
59
59
  this.files = specs;
60
60
  const inputFileSystem = this.compilation.inputFileSystem;
61
+ // TODO: don't use a sync fs method here
62
+ // eslint-disable-next-line no-restricted-syntax
61
63
  const utimesSync = (_a = inputFileSystem.fileSystem.utimesSync) !== null && _a !== void 0 ? _a : fs_extra_1.default.utimesSync;
62
64
  utimesSync(path_1.default.resolve(__dirname, 'browser.js'), new Date(), new Date());
63
65
  };
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createWebpackDevServer = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
5
+ const debug_1 = tslib_1.__importDefault(require("debug"));
6
6
  const makeWebpackConfig_1 = require("./makeWebpackConfig");
7
7
  const debug = (0, debug_1.default)('cypress:webpack-dev-server:start');
8
8
  async function createWebpackDevServer(config) {
@@ -14,7 +14,7 @@ async function createWebpackDevServer(config) {
14
14
  return webpackDevServer4(config, webpackCompiler, finalWebpackConfig);
15
15
  }
16
16
  if (webpackDevServerMajorVersion === 3) {
17
- debug('using webpack-dev-server v4');
17
+ debug('using webpack-dev-server v3');
18
18
  return webpackDevServer3(config, webpackCompiler, finalWebpackConfig);
19
19
  }
20
20
  throw new Error(`Unsupported webpackDevServer version ${webpackDevServerMajorVersion}`);
@@ -1,17 +1,26 @@
1
1
  /// <reference types="cypress" />
2
+ /// <reference types="cypress" />
2
3
  /// <reference types="node" />
3
4
  import type { Configuration } from 'webpack';
4
5
  import { SourceRelativeWebpackResult } from './helpers/sourceRelativeWebpackModules';
6
+ export declare type Frameworks = Extract<Cypress.DevServerConfigOptions, {
7
+ bundler: 'webpack';
8
+ }>['framework'];
9
+ declare type FrameworkConfig = {
10
+ framework?: Exclude<Frameworks, 'angular'>;
11
+ } | {
12
+ framework: 'angular';
13
+ options?: {
14
+ projectConfig: Cypress.AngularDevServerProjectConfig;
15
+ };
16
+ };
5
17
  export declare type WebpackDevServerConfig = {
6
18
  specs: Cypress.Spec[];
7
19
  cypressConfig: Cypress.PluginConfigOptions;
8
20
  devServerEvents: NodeJS.EventEmitter;
9
21
  onConfigNotFound?: (devServer: 'webpack', cwd: string, lookedIn: string[]) => void;
10
- } & {
11
- framework?: typeof ALL_FRAMEWORKS[number];
12
22
  webpackConfig?: unknown;
13
- };
14
- declare const ALL_FRAMEWORKS: readonly ["create-react-app", "nuxt", "react", "vue-cli", "next", "vue"];
23
+ } & FrameworkConfig;
15
24
  /**
16
25
  * import { devServer } from '@cypress/webpack-dev-server'
17
26
  *
@@ -25,11 +34,11 @@ export declare namespace devServer {
25
34
  var create: (devServerConfig: WebpackDevServerConfig) => Promise<{
26
35
  server: unknown;
27
36
  compiler: object;
28
- version: 4 | 3;
37
+ version: 3 | 4;
29
38
  }>;
30
39
  }
31
40
  export declare type PresetHandlerResult = {
32
- frameworkConfig?: Configuration;
41
+ frameworkConfig: Configuration;
33
42
  sourceWebpackModulesResult: SourceRelativeWebpackResult;
34
43
  };
35
44
  export default devServer;
package/dist/devServer.js CHANGED
@@ -4,14 +4,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.devServer = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const createWebpackDevServer_1 = require("./createWebpackDevServer");
7
- const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
7
+ const debug_1 = tslib_1.__importDefault(require("debug"));
8
8
  const vueCliHandler_1 = require("./helpers/vueCliHandler");
9
9
  const nuxtHandler_1 = require("./helpers/nuxtHandler");
10
10
  const createReactAppHandler_1 = require("./helpers/createReactAppHandler");
11
11
  const nextHandler_1 = require("./helpers/nextHandler");
12
12
  const sourceRelativeWebpackModules_1 = require("./helpers/sourceRelativeWebpackModules");
13
+ const angularHandler_1 = require("./helpers/angularHandler");
13
14
  const debug = (0, debug_1.default)('cypress:webpack-dev-server:devServer');
14
- const ALL_FRAMEWORKS = ['create-react-app', 'nuxt', 'react', 'vue-cli', 'next', 'vue'];
15
15
  /**
16
16
  * import { devServer } from '@cypress/webpack-dev-server'
17
17
  *
@@ -72,12 +72,15 @@ async function getPreset(devServerConfig) {
72
72
  return (0, vueCliHandler_1.vueCliHandler)(devServerConfig);
73
73
  case 'next':
74
74
  return await (0, nextHandler_1.nextHandler)(devServerConfig);
75
+ case 'angular':
76
+ return await (0, angularHandler_1.angularHandler)(devServerConfig);
75
77
  case 'react':
76
78
  case 'vue':
79
+ case 'svelte':
77
80
  case undefined:
78
81
  return { sourceWebpackModulesResult: (0, sourceRelativeWebpackModules_1.sourceDefaultWebpackDependencies)(devServerConfig) };
79
82
  default:
80
- throw new Error(`Unexpected framework ${devServerConfig.framework}, expected one of ${ALL_FRAMEWORKS.join(', ')}`);
83
+ throw new Error(`Unexpected framework ${devServerConfig.framework}, please visit https://docs.cypress.io/guides/component-testing/component-framework-configuration to see a list of supported frameworks`);
81
84
  }
82
85
  }
83
86
  /**
@@ -0,0 +1,81 @@
1
+ /// <reference types="cypress" />
2
+ import type { PresetHandlerResult, WebpackDevServerConfig } from '../devServer';
3
+ export declare type BuildOptions = Record<string, any>;
4
+ export declare type AngularWebpackDevServerConfig = Extract<WebpackDevServerConfig, {
5
+ framework: 'angular';
6
+ }>;
7
+ declare type Configurations = {
8
+ configurations?: {
9
+ [configuration: string]: BuildOptions;
10
+ };
11
+ };
12
+ export declare type AngularJsonProjectConfig = {
13
+ projectType: string;
14
+ root: string;
15
+ sourceRoot: string;
16
+ architect: {
17
+ build: {
18
+ options: BuildOptions;
19
+ } & Configurations;
20
+ };
21
+ };
22
+ declare type AngularJson = {
23
+ defaultProject?: string;
24
+ projects: {
25
+ [project: string]: AngularJsonProjectConfig;
26
+ };
27
+ };
28
+ export declare function getProjectConfig(projectRoot: string): Promise<Cypress.AngularDevServerProjectConfig>;
29
+ export declare function getAngularBuildOptions(buildOptions: BuildOptions, tsConfig: string): {
30
+ tsConfig: string;
31
+ aot: boolean;
32
+ outputHashing: string;
33
+ budgets: undefined;
34
+ outputPath: string;
35
+ assets: never[];
36
+ styles: never[];
37
+ scripts: never[];
38
+ fileReplacements: never[];
39
+ inlineStyleLanguage: string;
40
+ stylePreprocessorOptions: {
41
+ includePaths: never[];
42
+ };
43
+ resourcesOutputPath: undefined;
44
+ commonChunk: boolean;
45
+ baseHref: undefined;
46
+ deployUrl: undefined;
47
+ verbose: boolean;
48
+ progress: boolean;
49
+ i18nMissingTranslation: string;
50
+ i18nDuplicateTranslation: string;
51
+ localize: undefined;
52
+ watch: boolean;
53
+ poll: undefined;
54
+ deleteOutputPath: boolean;
55
+ preserveSymlinks: undefined;
56
+ showCircularDependencies: boolean;
57
+ subresourceIntegrity: boolean;
58
+ serviceWorker: boolean;
59
+ ngswConfigPath: undefined;
60
+ statsJson: boolean;
61
+ webWorkerTsConfig: undefined;
62
+ crossOrigin: string;
63
+ allowedCommonJsDependencies: never[];
64
+ buildOptimizer: boolean;
65
+ optimization: boolean;
66
+ vendorChunk: boolean;
67
+ extractLicenses: boolean;
68
+ sourceMap: boolean;
69
+ namedChunks: boolean;
70
+ };
71
+ export declare function generateTsConfig(devServerConfig: AngularWebpackDevServerConfig, buildOptions: BuildOptions): Promise<string>;
72
+ export declare function getTempDir(): Promise<string>;
73
+ export declare function getAngularCliModules(projectRoot: string): Promise<{
74
+ generateBrowserWebpackConfigFromContext: any;
75
+ getCommonConfig: any;
76
+ getStylesConfig: any;
77
+ }>;
78
+ export declare function getAngularJson(projectRoot: string): Promise<AngularJson>;
79
+ export declare const toPosix: (filePath: string) => string;
80
+ export declare function angularHandler(devServerConfig: AngularWebpackDevServerConfig): Promise<PresetHandlerResult>;
81
+ export {};
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.angularHandler = exports.toPosix = exports.getAngularJson = exports.getAngularCliModules = exports.getTempDir = exports.generateTsConfig = exports.getAngularBuildOptions = exports.getProjectConfig = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const fs = tslib_1.__importStar(require("fs-extra"));
6
+ const os_1 = require("os");
7
+ const path = tslib_1.__importStar(require("path"));
8
+ const url_1 = require("url");
9
+ const sourceRelativeWebpackModules_1 = require("./sourceRelativeWebpackModules");
10
+ const dynamicImport = new Function('specifier', 'return import(specifier)');
11
+ async function getProjectConfig(projectRoot) {
12
+ var _a;
13
+ const angularJson = await getAngularJson(projectRoot);
14
+ let { defaultProject } = angularJson;
15
+ if (!defaultProject) {
16
+ defaultProject = Object.keys(angularJson.projects).find((name) => angularJson.projects[name].projectType === 'application');
17
+ if (!defaultProject) {
18
+ throw new Error('Could not find a project with projectType "application" in "angular.json". Visit https://docs.cypress.io/guides/references/configuration#Options-API to see how to pass in a custom project configuration');
19
+ }
20
+ }
21
+ const defaultProjectConfig = angularJson.projects[defaultProject];
22
+ const { architect, root, sourceRoot } = defaultProjectConfig;
23
+ const { build } = architect;
24
+ return {
25
+ root,
26
+ sourceRoot,
27
+ buildOptions: Object.assign(Object.assign({}, build.options), ((_a = build.configurations) === null || _a === void 0 ? void 0 : _a.development) || {}),
28
+ };
29
+ }
30
+ exports.getProjectConfig = getProjectConfig;
31
+ function getAngularBuildOptions(buildOptions, tsConfig) {
32
+ // Default options are derived from the @angular-devkit/build-angular browser builder, with some options from
33
+ // the serve builder thrown in for development.
34
+ // see: https://github.com/angular/angular-cli/blob/main/packages/angular_devkit/build_angular/src/builders/browser/schema.json
35
+ return Object.assign(Object.assign({ outputPath: 'dist/angular-app', assets: [], styles: [], scripts: [], fileReplacements: [], inlineStyleLanguage: 'css', stylePreprocessorOptions: { includePaths: [] }, resourcesOutputPath: undefined, commonChunk: true, baseHref: undefined, deployUrl: undefined, verbose: false, progress: false, i18nMissingTranslation: 'warning', i18nDuplicateTranslation: 'warning', localize: undefined, watch: true, poll: undefined, deleteOutputPath: true, preserveSymlinks: undefined, showCircularDependencies: false, subresourceIntegrity: false, serviceWorker: false, ngswConfigPath: undefined, statsJson: false, webWorkerTsConfig: undefined, crossOrigin: 'none', allowedCommonJsDependencies: [], buildOptimizer: false, optimization: false, vendorChunk: true, extractLicenses: false, sourceMap: true, namedChunks: true }, buildOptions), { tsConfig, aot: false, outputHashing: 'none', budgets: undefined });
36
+ }
37
+ exports.getAngularBuildOptions = getAngularBuildOptions;
38
+ async function generateTsConfig(devServerConfig, buildOptions) {
39
+ const { cypressConfig } = devServerConfig;
40
+ const { projectRoot } = cypressConfig;
41
+ const specPattern = Array.isArray(cypressConfig.specPattern) ? cypressConfig.specPattern : [cypressConfig.specPattern];
42
+ const getProjectFilePath = (...fileParts) => (0, exports.toPosix)(path.join(projectRoot, ...fileParts));
43
+ const includePaths = [...specPattern.map((pattern) => getProjectFilePath(pattern))];
44
+ if (cypressConfig.supportFile) {
45
+ includePaths.push((0, exports.toPosix)(cypressConfig.supportFile));
46
+ }
47
+ if (buildOptions.polyfills) {
48
+ const polyfills = getProjectFilePath(buildOptions.polyfills);
49
+ includePaths.push(polyfills);
50
+ }
51
+ const cypressTypes = getProjectFilePath('node_modules', 'cypress', 'types', 'index.d.ts');
52
+ includePaths.push(cypressTypes);
53
+ const tsConfigContent = JSON.stringify({
54
+ extends: getProjectFilePath('tsconfig.json'),
55
+ compilerOptions: {
56
+ outDir: getProjectFilePath('out-tsc/cy'),
57
+ allowSyntheticDefaultImports: true,
58
+ skipLibCheck: true,
59
+ },
60
+ include: includePaths,
61
+ });
62
+ const tsConfigPath = path.join(await getTempDir(), 'tsconfig.json');
63
+ await fs.writeFile(tsConfigPath, tsConfigContent);
64
+ return tsConfigPath;
65
+ }
66
+ exports.generateTsConfig = generateTsConfig;
67
+ async function getTempDir() {
68
+ const cypressTempDir = path.join((0, os_1.tmpdir)(), 'cypress-angular-ct');
69
+ await fs.ensureDir(cypressTempDir);
70
+ return cypressTempDir;
71
+ }
72
+ exports.getTempDir = getTempDir;
73
+ async function getAngularCliModules(projectRoot) {
74
+ const [{ generateBrowserWebpackConfigFromContext }, { getCommonConfig }, { getStylesConfig },] = await Promise.all([
75
+ '@angular-devkit/build-angular/src/utils/webpack-browser-config.js',
76
+ '@angular-devkit/build-angular/src/webpack/configs/common.js',
77
+ '@angular-devkit/build-angular/src/webpack/configs/styles.js',
78
+ ].map((dep) => {
79
+ try {
80
+ const depPath = require.resolve(dep, { paths: [projectRoot] });
81
+ const url = (0, url_1.pathToFileURL)(depPath).href;
82
+ return dynamicImport(url);
83
+ }
84
+ catch (e) {
85
+ throw new Error(`Could not resolve "${dep}". Do you have "@angular-devkit/build-angular" installed?`);
86
+ }
87
+ }));
88
+ return {
89
+ generateBrowserWebpackConfigFromContext,
90
+ getCommonConfig,
91
+ getStylesConfig,
92
+ };
93
+ }
94
+ exports.getAngularCliModules = getAngularCliModules;
95
+ async function getAngularJson(projectRoot) {
96
+ const { findUp } = await dynamicImport('find-up');
97
+ const angularJsonPath = await findUp('angular.json', { cwd: projectRoot });
98
+ if (!angularJsonPath) {
99
+ throw new Error(`Could not find angular.json. Looked in ${projectRoot} and up.`);
100
+ }
101
+ const angularJson = await fs.readFile(angularJsonPath, 'utf8');
102
+ return JSON.parse(angularJson);
103
+ }
104
+ exports.getAngularJson = getAngularJson;
105
+ function createFakeContext(projectRoot, defaultProjectConfig) {
106
+ const logger = {
107
+ createChild: () => ({}),
108
+ };
109
+ const context = {
110
+ target: {
111
+ project: 'angular',
112
+ },
113
+ workspaceRoot: projectRoot,
114
+ getProjectMetadata: () => {
115
+ return {
116
+ root: defaultProjectConfig.root,
117
+ sourceRoot: defaultProjectConfig.root,
118
+ projectType: 'application',
119
+ };
120
+ },
121
+ logger,
122
+ };
123
+ return context;
124
+ }
125
+ const toPosix = (filePath) => filePath.split(path.sep).join(path.posix.sep);
126
+ exports.toPosix = toPosix;
127
+ async function getAngularCliWebpackConfig(devServerConfig) {
128
+ var _a;
129
+ const { projectRoot } = devServerConfig.cypressConfig;
130
+ const { generateBrowserWebpackConfigFromContext, getCommonConfig, getStylesConfig, } = await getAngularCliModules(projectRoot);
131
+ // normalize
132
+ const projectConfig = ((_a = devServerConfig.options) === null || _a === void 0 ? void 0 : _a.projectConfig) || await getProjectConfig(projectRoot);
133
+ const tsConfig = await generateTsConfig(devServerConfig, projectConfig.buildOptions);
134
+ const buildOptions = getAngularBuildOptions(projectConfig.buildOptions, tsConfig);
135
+ const context = createFakeContext(projectRoot, projectConfig);
136
+ const { config } = await generateBrowserWebpackConfigFromContext(buildOptions, context, (wco) => [getCommonConfig(wco), getStylesConfig(wco)]);
137
+ delete config.entry.main;
138
+ return config;
139
+ }
140
+ async function angularHandler(devServerConfig) {
141
+ const webpackConfig = await getAngularCliWebpackConfig(devServerConfig);
142
+ return { frameworkConfig: webpackConfig, sourceWebpackModulesResult: (0, sourceRelativeWebpackModules_1.sourceDefaultWebpackDependencies)(devServerConfig) };
143
+ }
144
+ exports.angularHandler = angularHandler;
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.reactScriptsFiveModifications = exports.cypressGlobals = exports.createReactAppHandler = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
6
- const path_1 = (0, tslib_1.__importDefault)(require("path"));
5
+ const debug_1 = tslib_1.__importDefault(require("debug"));
6
+ const path_1 = tslib_1.__importDefault(require("path"));
7
7
  const sourceRelativeWebpackModules_1 = require("./sourceRelativeWebpackModules");
8
8
  const debug = (0, debug_1.default)('cypress:webpack-dev-server:create-react-app');
9
9
  /**
@@ -1,2 +1,3 @@
1
1
  import type { PresetHandlerResult, WebpackDevServerConfig } from '../devServer';
2
2
  export declare function nextHandler(devServerConfig: WebpackDevServerConfig): Promise<PresetHandlerResult>;
3
+ export declare const allCssTests: RegExp[];
@@ -1,23 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nextHandler = void 0;
3
+ exports.allCssTests = exports.nextHandler = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
6
- const module_1 = (0, tslib_1.__importDefault)(require("module"));
7
- const fs = (0, tslib_1.__importStar)(require("fs"));
8
- const path = (0, tslib_1.__importStar)(require("path"));
5
+ const debug_1 = tslib_1.__importDefault(require("debug"));
6
+ const module_1 = tslib_1.__importDefault(require("module"));
7
+ const fs = tslib_1.__importStar(require("fs"));
8
+ const path = tslib_1.__importStar(require("path"));
9
9
  const sourceRelativeWebpackModules_1 = require("./sourceRelativeWebpackModules");
10
10
  const debug = (0, debug_1.default)('cypress:webpack-dev-server-fresh:nextHandler');
11
11
  async function nextHandler(devServerConfig) {
12
12
  const webpackConfig = await loadWebpackConfig(devServerConfig);
13
13
  debug('resolved next.js webpack config %o', webpackConfig);
14
14
  checkSWC(webpackConfig, devServerConfig.cypressConfig);
15
- // Next webpack compiler ignored watching any node_modules changes, but we need to watch
16
- // for changes to 'dist/browser.js' in order to detect new specs that have been added
17
- if (webpackConfig.watchOptions && Array.isArray(webpackConfig.watchOptions.ignored)) {
18
- webpackConfig.watchOptions = Object.assign(Object.assign({}, webpackConfig.watchOptions), { ignored: [...webpackConfig.watchOptions.ignored.filter((pattern) => !/node_modules/.test(pattern)), '**/node_modules/!(@cypress/webpack-dev-server/dist/browser.js)**'] });
19
- debug('found options next.js watchOptions.ignored %O', webpackConfig.watchOptions.ignored);
20
- }
15
+ watchEntryPoint(webpackConfig);
16
+ allowGlobalStylesImports(webpackConfig);
17
+ changeNextCachePath(webpackConfig);
21
18
  return { frameworkConfig: webpackConfig, sourceWebpackModulesResult: sourceNextWebpackDeps(devServerConfig) };
22
19
  }
23
20
  exports.nextHandler = nextHandler;
@@ -51,7 +48,7 @@ async function loadWebpackConfig(devServerConfig) {
51
48
  const { loadConfig, getNextJsBaseWebpackConfig } = getNextJsPackages(devServerConfig);
52
49
  const nextConfig = await loadConfig('development', devServerConfig.cypressConfig.projectRoot);
53
50
  const runWebpackSpan = getRunWebpackSpan(devServerConfig);
54
- const webpackConfig = await getNextJsBaseWebpackConfig(devServerConfig.cypressConfig.projectRoot, Object.assign(Object.assign({ buildId: `@cypress/react-${Math.random().toString()}`, config: nextConfig, dev: true, pagesDir: findPagesDir(devServerConfig.cypressConfig.projectRoot), entrypoints: {}, rewrites: { fallback: [], afterFiles: [], beforeFiles: [] } }, runWebpackSpan), {
51
+ const webpackConfig = await getNextJsBaseWebpackConfig(devServerConfig.cypressConfig.projectRoot, Object.assign(Object.assign({ buildId: `@cypress/react-${Math.random().toString()}`, config: nextConfig, dev: true, pagesDir: await findPagesDir(devServerConfig.cypressConfig.projectRoot), entrypoints: {}, rewrites: { fallback: [], afterFiles: [], beforeFiles: [] } }, runWebpackSpan), {
55
52
  // Client webpack config for Next.js <= 12.1.5
56
53
  isServer: false,
57
54
  // Client webpack config for Next.js > 12.1.5
@@ -75,9 +72,9 @@ function checkSWC(webpackConfig, cypressConfig) {
75
72
  }
76
73
  return false;
77
74
  }
78
- const existsSync = (file) => {
75
+ const exists = async (file) => {
79
76
  try {
80
- fs.accessSync(file, fs.constants.F_OK);
77
+ await fs.promises.access(file, fs.constants.F_OK);
81
78
  return true;
82
79
  }
83
80
  catch (_) {
@@ -89,14 +86,14 @@ const existsSync = (file) => {
89
86
  * `${projectRoot}/pages` or `${projectRoot}/src/pages`.
90
87
  * If neither is found, return projectRoot
91
88
  */
92
- function findPagesDir(projectRoot) {
89
+ async function findPagesDir(projectRoot) {
93
90
  // prioritize ./pages over ./src/pages
94
91
  let pagesDir = path.join(projectRoot, 'pages');
95
- if (existsSync(pagesDir)) {
92
+ if (await exists(pagesDir)) {
96
93
  return pagesDir;
97
94
  }
98
95
  pagesDir = path.join(projectRoot, 'src', 'pages');
99
- if (existsSync(pagesDir)) {
96
+ if (await exists(pagesDir)) {
100
97
  return pagesDir;
101
98
  }
102
99
  return projectRoot;
@@ -195,3 +192,45 @@ function sourceNextWebpack(devServerConfig, framework) {
195
192
  };
196
193
  return webpack;
197
194
  }
195
+ // Next webpack compiler ignored watching any node_modules changes, but we need to watch
196
+ // for changes to 'dist/browser.js' in order to detect new specs that have been added
197
+ function watchEntryPoint(webpackConfig) {
198
+ if (webpackConfig.watchOptions && Array.isArray(webpackConfig.watchOptions.ignored)) {
199
+ webpackConfig.watchOptions = Object.assign(Object.assign({}, webpackConfig.watchOptions), { ignored: [...webpackConfig.watchOptions.ignored.filter((pattern) => !/node_modules/.test(pattern)), '**/node_modules/!(@cypress/webpack-dev-server/dist/browser.js)**'] });
200
+ debug('found options next.js watchOptions.ignored %O', webpackConfig.watchOptions.ignored);
201
+ }
202
+ }
203
+ // We are matching the Next.js regex rules exactly. If we were writing our own loader, we could
204
+ // condense these regex rules into a single rule but we need the regex.source to be identical to what
205
+ // we get from Next.js webpack config
206
+ // see: https://github.com/vercel/next.js/blob/20486c159d8538a337da6b07b0b4490a3a0d6b91/packages/next/build/webpack/config/blocks/css/index.ts#L18
207
+ const globalCssRe = [/(?<!\.module)\.css$/, /(?<!\.module)\.(scss|sass)$/];
208
+ const globalCssModulesRe = [/\.module\.css$/, /\.module\.(scss|sass)$/];
209
+ exports.allCssTests = [...globalCssRe, ...globalCssModulesRe];
210
+ // Next does not allow global styles to be loaded outside of the main <App /> component.
211
+ // We want users to be able to import the global styles into their component support file so we
212
+ // delete the "issuer" from the rules that process css/scss files.
213
+ // see: https://github.com/cypress-io/cypress/issues/22525
214
+ // Motivated by: https://github.com/bem/next-global-css
215
+ function allowGlobalStylesImports(webpackConfig) {
216
+ var _a;
217
+ const rules = ((_a = webpackConfig.module) === null || _a === void 0 ? void 0 : _a.rules) || [];
218
+ for (const rule of rules) {
219
+ if (typeof rule !== 'string' && rule.oneOf) {
220
+ for (const oneOf of rule.oneOf) {
221
+ if (oneOf.test && exports.allCssTests.some((re) => { var _a; return re.source === ((_a = oneOf.test) === null || _a === void 0 ? void 0 : _a.source); })) {
222
+ delete oneOf.issuer;
223
+ }
224
+ }
225
+ }
226
+ }
227
+ }
228
+ // Our modifications of the Next webpack config can corrupt the cache used for local development.
229
+ // We separate the cache used for CT from the normal cache (".next/cache/webpack" -> ".next/cache/cypress-webpack") so they don't interfere with each other
230
+ function changeNextCachePath(webpackConfig) {
231
+ if (typeof webpackConfig.cache === 'object' && ('cacheDirectory' in webpackConfig.cache) && webpackConfig.cache.cacheDirectory) {
232
+ const { cacheDirectory } = webpackConfig.cache;
233
+ webpackConfig.cache.cacheDirectory = cacheDirectory.replace(/webpack$/, 'cypress-webpack');
234
+ debug('Changing Next cache path from %s to %s', cacheDirectory, webpackConfig.cache.cacheDirectory);
235
+ }
236
+ }
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nuxtHandler = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
5
+ const debug_1 = tslib_1.__importDefault(require("debug"));
6
6
  const sourceRelativeWebpackModules_1 = require("./sourceRelativeWebpackModules");
7
7
  const debug = (0, debug_1.default)('cypress:webpack-dev-server:nuxtHandler');
8
8
  async function nuxtHandler(devServerConfig) {
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.restoreLoadHook = exports.getMajorVersion = exports.sourceDefaultWebpackDependencies = exports.sourceHtmlWebpackPlugin = exports.sourceWebpackDevServer = exports.sourceWebpack = exports.sourceFramework = exports.cypressWebpackPath = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const module_1 = (0, tslib_1.__importDefault)(require("module"));
6
- const path_1 = (0, tslib_1.__importDefault)(require("path"));
7
- const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
5
+ const module_1 = tslib_1.__importDefault(require("module"));
6
+ const path_1 = tslib_1.__importDefault(require("path"));
7
+ const debug_1 = tslib_1.__importDefault(require("debug"));
8
8
  const debug = (0, debug_1.default)('cypress:webpack-dev-server:sourceRelativeWebpackModules');
9
9
  const originalModuleLoad = module_1.default._load;
10
10
  const originalModuleResolveFilename = module_1.default._resolveFilename;
@@ -16,7 +16,17 @@ const cypressWebpackPath = (config) => {
16
16
  });
17
17
  };
18
18
  exports.cypressWebpackPath = cypressWebpackPath;
19
- // Source the users framework from the provided projectRoot. The framework, if available, will server
19
+ const frameworkWebpackMapper = {
20
+ 'create-react-app': 'react-scripts',
21
+ 'vue-cli': '@vue/cli-service',
22
+ 'nuxt': '@nuxt/webpack',
23
+ react: undefined,
24
+ vue: undefined,
25
+ next: 'next',
26
+ 'angular': '@angular-devkit/build-angular',
27
+ 'svelte': undefined,
28
+ };
29
+ // Source the users framework from the provided projectRoot. The framework, if available, will serve
20
30
  // as the resolve base for webpack dependency resolution.
21
31
  function sourceFramework(config) {
22
32
  debug('Framework: Attempting to source framework for %s', config.cypressConfig.projectRoot);
@@ -24,9 +34,14 @@ function sourceFramework(config) {
24
34
  debug('Framework: No framework provided');
25
35
  return null;
26
36
  }
37
+ const sourceOfWebpack = frameworkWebpackMapper[config.framework];
38
+ if (!sourceOfWebpack) {
39
+ debug('Not a higher-order framework so webpack dependencies should be resolvable from projectRoot');
40
+ return null;
41
+ }
27
42
  const framework = {};
28
43
  try {
29
- const frameworkJsonPath = require.resolve(`${config.framework}/package.json`, {
44
+ const frameworkJsonPath = require.resolve(`${sourceOfWebpack}/package.json`, {
30
45
  paths: [config.cypressConfig.projectRoot],
31
46
  });
32
47
  const frameworkPathRoot = path_1.default.dirname(frameworkJsonPath);
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.vueCliHandler = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
5
+ const debug_1 = tslib_1.__importDefault(require("debug"));
6
6
  const sourceRelativeWebpackModules_1 = require("./sourceRelativeWebpackModules");
7
7
  const debug = (0, debug_1.default)('cypress:webpack-dev-server:vueCliHandler');
8
8
  function vueCliHandler(devServerConfig) {
package/dist/loader.js CHANGED
@@ -3,8 +3,8 @@
3
3
  /// <reference types="cypress" />
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  const tslib_1 = require("tslib");
6
- const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
7
- const path = (0, tslib_1.__importStar)(require("path"));
6
+ const debug_1 = tslib_1.__importDefault(require("debug"));
7
+ const path = tslib_1.__importStar(require("path"));
8
8
  const debug = (0, debug_1.default)('cypress:webpack-dev-server:webpack');
9
9
  /**
10
10
  * @param {ComponentSpec} file spec to create import string from.
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeDefaultWebpackConfig = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const path_1 = (0, tslib_1.__importDefault)(require("path"));
6
- const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
5
+ const path_1 = tslib_1.__importDefault(require("path"));
6
+ const debug_1 = tslib_1.__importDefault(require("debug"));
7
7
  const debug = (0, debug_1.default)('cypress:webpack-dev-server:makeDefaultWebpackConfig');
8
8
  const OUTPUT_PATH = path_1.default.join(__dirname, 'dist');
9
9
  /**
@@ -27,10 +27,7 @@ function makeDefaultWebpackConfig(config) {
27
27
  path: OUTPUT_PATH,
28
28
  },
29
29
  plugins: [
30
- new HtmlWebpackPlugin({
31
- // Todo: Add indexHtmlFile when it gets added as a config property
32
- template: indexHtmlFile,
33
- }),
30
+ new HtmlWebpackPlugin(Object.assign({ template: indexHtmlFile }, (config.devServerConfig.framework === 'angular' ? { scriptLoading: 'module' } : {}))),
34
31
  ],
35
32
  };
36
33
  if (config.sourceWebpackModulesResult.webpackDevServer.majorVersion === 4) {
@@ -1,4 +1,5 @@
1
1
  import type { CreateFinalWebpackConfig } from './createWebpackDevServer';
2
+ export declare const CYPRESS_WEBPACK_ENTRYPOINT: string;
2
3
  /**
3
4
  * Creates a webpack 4/5 compatible webpack "configuration"
4
5
  * to pass to the sourced webpack function
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeWebpackConfig = void 0;
3
+ exports.makeWebpackConfig = exports.CYPRESS_WEBPACK_ENTRYPOINT = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const debug_1 = require("debug");
6
- const path = (0, tslib_1.__importStar)(require("path"));
6
+ const path = tslib_1.__importStar(require("path"));
7
7
  const webpack_merge_1 = require("webpack-merge");
8
8
  const local_pkg_1 = require("local-pkg");
9
9
  const makeDefaultWebpackConfig_1 = require("./makeDefaultWebpackConfig");
@@ -35,7 +35,7 @@ if (process.platform === 'linux') {
35
35
  }
36
36
  const OsSeparatorRE = RegExp(`\\${path.sep}`, 'g');
37
37
  const posixSeparator = '/';
38
- const CYPRESS_WEBPACK_ENTRYPOINT = path.resolve(__dirname, 'browser.js');
38
+ exports.CYPRESS_WEBPACK_ENTRYPOINT = path.resolve(__dirname, 'browser.js');
39
39
  /**
40
40
  * Removes and/or modifies certain plugins known to conflict
41
41
  * when used with cypress/webpack-dev-server.
@@ -69,7 +69,7 @@ async function makeWebpackConfig(config) {
69
69
  const { module: webpack } = config.sourceWebpackModulesResult.webpack;
70
70
  let userWebpackConfig = config.devServerConfig.webpackConfig;
71
71
  const frameworkWebpackConfig = config.frameworkConfig;
72
- const { cypressConfig: { projectRoot, devServerPublicPathRoute, supportFile, }, specs: files, devServerEvents, } = config.devServerConfig;
72
+ const { cypressConfig: { projectRoot, devServerPublicPathRoute, supportFile, }, specs: files, devServerEvents, framework, } = config.devServerConfig;
73
73
  let configFile = undefined;
74
74
  if (!userWebpackConfig && !frameworkWebpackConfig) {
75
75
  debug('Not user or framework webpack config received. Trying to automatically source it');
@@ -122,7 +122,13 @@ async function makeWebpackConfig(config) {
122
122
  ],
123
123
  };
124
124
  const mergedConfig = (0, webpack_merge_1.merge)(userAndFrameworkWebpackConfig, (0, makeDefaultWebpackConfig_1.makeDefaultWebpackConfig)(config), dynamicWebpackConfig);
125
- mergedConfig.entry = CYPRESS_WEBPACK_ENTRYPOINT;
125
+ // Angular loads global styles and polyfills via script injection in the index.html
126
+ if (framework === 'angular') {
127
+ mergedConfig.entry = Object.assign(Object.assign({}, mergedConfig.entry || {}), { 'cypress-entry': exports.CYPRESS_WEBPACK_ENTRYPOINT });
128
+ }
129
+ else {
130
+ mergedConfig.entry = exports.CYPRESS_WEBPACK_ENTRYPOINT;
131
+ }
126
132
  debug('Merged webpack config %o', mergedConfig);
127
133
  if (process.env.WEBPACK_PERF_MEASURE) {
128
134
  // only for debugging
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.measureWebpackPerformance = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ /* eslint-disable no-restricted-syntax */
5
6
  /* eslint-disable no-console */
6
- const path_1 = (0, tslib_1.__importDefault)(require("path"));
7
- const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
8
- const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
9
- const speed_measure_webpack_plugin_1 = (0, tslib_1.__importDefault)(require("speed-measure-webpack-plugin"));
7
+ const path_1 = tslib_1.__importDefault(require("path"));
8
+ const fs_1 = tslib_1.__importDefault(require("fs"));
9
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
10
+ const speed_measure_webpack_plugin_1 = tslib_1.__importDefault(require("speed-measure-webpack-plugin"));
10
11
  /**
11
12
  * @internal
12
13
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cypress/webpack-dev-server",
3
- "version": "2.0.0",
3
+ "version": "2.3.0",
4
4
  "description": "Launches Webpack Dev Server for Component Testing",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/CHANGELOG.md DELETED
@@ -1,225 +0,0 @@
1
- # [@cypress/webpack-dev-server-v2.0.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.4...@cypress/webpack-dev-server-v2.0.0) (2022-06-13)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * add package.json metadata for webpack-dev-server ([#22292](https://github.com/cypress-io/cypress/issues/22292)) ([9cfec97](https://github.com/cypress-io/cypress/commit/9cfec9750f2ddc9fe691aabbe2ecc9bc02a3d915))
7
- * ct testing support for node 17+ ([#21430](https://github.com/cypress-io/cypress/issues/21430)) ([0f786ab](https://github.com/cypress-io/cypress/commit/0f786ab893d178c2f87eed6a1334a248c6bec7a6))
8
- * display cy.mount command log ([#21500](https://github.com/cypress-io/cypress/issues/21500)) ([140b4ba](https://github.com/cypress-io/cypress/commit/140b4ba2110243712a614a39b2408c30cce4d0b1))
9
- * Ensuring spec file presence prior to webpack-dev-server compilation ([#21550](https://github.com/cypress-io/cypress/issues/21550)) ([87eec2b](https://github.com/cypress-io/cypress/commit/87eec2b460b02a123667b40ee907878fa4be2bee))
10
- * Guard against slow requests in GraphQL Resolution (part 2) ([#21020](https://github.com/cypress-io/cypress/issues/21020)) ([b0c8db3](https://github.com/cypress-io/cypress/commit/b0c8db34348be31f32795f3f67c3408403d59ace))
11
- * issue with compilation failures in component testing ([#21599](https://github.com/cypress-io/cypress/issues/21599)) ([f2bce02](https://github.com/cypress-io/cypress/commit/f2bce02f5dcab7a73a2a1b8e102518d706a29c25))
12
- * next 12.1.6 support and add tests ([#21515](https://github.com/cypress-io/cypress/issues/21515)) ([ada7179](https://github.com/cypress-io/cypress/commit/ada7179acb4ff0ca0057714883153cc9b2006daa))
13
- * restart dev-server on config change ([#21212](https://github.com/cypress-io/cypress/issues/21212)) ([00a0f5a](https://github.com/cypress-io/cypress/commit/00a0f5a0e905fdfe5ef9f8ba71f915ed20ca4b72))
14
- * supportFile path and supportFile false for vite on windows ([#21156](https://github.com/cypress-io/cypress/issues/21156)) ([dd180c8](https://github.com/cypress-io/cypress/commit/dd180c89b27546b0c96cc3f4fb4e75d983c8003e))
15
- * UNIFY-1774 error if component config is not sourced for webpack/vite ([#21563](https://github.com/cypress-io/cypress/issues/21563)) ([566a7b1](https://github.com/cypress-io/cypress/commit/566a7b1feb0fc1a8f1ccf83a23d8ad7a94409a6b))
16
- * wire up scaffolded indexHtml to dev servers ([#20453](https://github.com/cypress-io/cypress/issues/20453)) ([3a8797e](https://github.com/cypress-io/cypress/commit/3a8797e54db9fd0ef93a14ddc71c138ba8251e53))
17
-
18
-
19
- ### chore
20
-
21
- * prep npm packages for use with Cypress v10 ([b924d08](https://github.com/cypress-io/cypress/commit/b924d086ee2e2ccc93303731e001b2c9e9d0af17))
22
-
23
-
24
- ### Features
25
-
26
- * add new webpack-dev-server package based on object API & bundling ([#20861](https://github.com/cypress-io/cypress/issues/20861)) ([e1da852](https://github.com/cypress-io/cypress/commit/e1da8524733c0ebedc2aed5c97117adb25fa733b))
27
- * Add typings for new devServer config ([#18797](https://github.com/cypress-io/cypress/issues/18797)) ([e018a14](https://github.com/cypress-io/cypress/commit/e018a14c211bfcbdc4568a9a737f14f5c1686e35))
28
- * Deprecate run-ct / open-ct, and update all examples to use --ct instead ([#18422](https://github.com/cypress-io/cypress/issues/18422)) ([196e8f6](https://github.com/cypress-io/cypress/commit/196e8f62cc6d27974f235945cb5700624b3dae41))
29
- * index.html configurability and storybook support ([#18242](https://github.com/cypress-io/cypress/issues/18242)) ([745b3ac](https://github.com/cypress-io/cypress/commit/745b3ac4518302983522daedf817623334feae5b))
30
- * merging / delegating remote queries to cloud schema ([#17875](https://github.com/cypress-io/cypress/issues/17875)) ([94541d4](https://github.com/cypress-io/cypress/commit/94541d4f18591e8fa4b8702c39e92b0a7238aa5d))
31
- * swap the #__cy_root id selector to become data-cy-root for component mounting ([#20951](https://github.com/cypress-io/cypress/issues/20951)) ([0e7b555](https://github.com/cypress-io/cypress/commit/0e7b555f93fb403f431c5de4a07ae7ad6ac89ba2))
32
-
33
-
34
- ### BREAKING CHANGES
35
-
36
- * new version of packages for Cypress v10
37
-
38
- # [@cypress/webpack-dev-server-v1.8.4](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.3...@cypress/webpack-dev-server-v1.8.4) (2022-03-29)
39
-
40
-
41
- ### Bug Fixes
42
-
43
- * **deps:** add 'lodash' to webpack-dev-server plugin dependencies ([#20815](https://github.com/cypress-io/cypress/issues/20815)) ([a472427](https://github.com/cypress-io/cypress/commit/a4724271601aff110c68ae4364e68764f22cd12c))
44
-
45
- # [@cypress/webpack-dev-server-v1.8.3](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.2...@cypress/webpack-dev-server-v1.8.3) (2022-03-15)
46
-
47
-
48
- ### Bug Fixes
49
-
50
- * **webpack-dev-server:** do not encodeUri in loader ([#20575](https://github.com/cypress-io/cypress/issues/20575)) ([1b152fc](https://github.com/cypress-io/cypress/commit/1b152fca1b9ed9894cf7a5b2a964c856f73fc685)), closes [#20593](https://github.com/cypress-io/cypress/issues/20593)
51
-
52
- # [@cypress/webpack-dev-server-v1.8.2](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.1...@cypress/webpack-dev-server-v1.8.2) (2022-03-03)
53
-
54
-
55
- ### Bug Fixes
56
-
57
- * avoid nextjs unsafeCache and watchOptions ([#20440](https://github.com/cypress-io/cypress/issues/20440)) ([9f60901](https://github.com/cypress-io/cypress/commit/9f6090170b0675d25b26b98cd0f987a5e395ab78))
58
- * error regression - strip ansi colors out of cy.fixture() error message ([#20335](https://github.com/cypress-io/cypress/issues/20335)) ([e0bd6ac](https://github.com/cypress-io/cypress/commit/e0bd6ac2aaf8d00b9233fffefed8f6ed2484bf45))
59
-
60
- # [@cypress/webpack-dev-server-v1.8.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.8.0...@cypress/webpack-dev-server-v1.8.1) (2022-02-08)
61
-
62
-
63
- ### Bug Fixes
64
-
65
- * detect newly added specs in dev-server compilation ([#17950](https://github.com/cypress-io/cypress/issues/17950)) ([f9ce67c](https://github.com/cypress-io/cypress/commit/f9ce67cfb6fed74a3549e7aff7ce0a5b217d9a13))
66
-
67
- # [@cypress/webpack-dev-server-v1.8.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.7.0...@cypress/webpack-dev-server-v1.8.0) (2021-12-16)
68
-
69
-
70
- ### Features
71
-
72
- * use hoisted yarn install in binary build ([#17285](https://github.com/cypress-io/cypress/issues/17285)) ([e4f5b10](https://github.com/cypress-io/cypress/commit/e4f5b106d49d6ac0857c5fdac886f83b99558c88))
73
-
74
- # [@cypress/webpack-dev-server-v1.7.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.6.0...@cypress/webpack-dev-server-v1.7.0) (2021-10-15)
75
-
76
-
77
- ### Features
78
-
79
- * normalized signatures webpack & vite servers ([#18379](https://github.com/cypress-io/cypress/issues/18379)) ([8f5308f](https://github.com/cypress-io/cypress/commit/8f5308f7068b80fb877da539ce34fb67ba497c4f))
80
-
81
- # [@cypress/webpack-dev-server-v1.6.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.5.0...@cypress/webpack-dev-server-v1.6.0) (2021-09-10)
82
-
83
-
84
- ### Features
85
-
86
- * allow usage of @react/plugins with cypress.config.js ([#17738](https://github.com/cypress-io/cypress/issues/17738)) ([da4b1e0](https://github.com/cypress-io/cypress/commit/da4b1e06ce33945aabddda0e6e175dc0e1b488a5))
87
-
88
- # [@cypress/webpack-dev-server-v1.5.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.4.0...@cypress/webpack-dev-server-v1.5.0) (2021-08-30)
89
-
90
-
91
- ### Features
92
-
93
- * support webpack-dev-server v4 ([#17918](https://github.com/cypress-io/cypress/issues/17918)) ([16e4759](https://github.com/cypress-io/cypress/commit/16e4759e0196f68c5f0525efb020211337748f94))
94
-
95
- # [@cypress/webpack-dev-server-v1.4.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.3.1...@cypress/webpack-dev-server-v1.4.0) (2021-06-17)
96
-
97
-
98
- ### Features
99
-
100
- * **npm/webpack-dev-server,runner-ct:** Normalize webpack errors + general React/TS improvements ([#16613](https://github.com/cypress-io/cypress/issues/16613)) ([c0fc23a](https://github.com/cypress-io/cypress/commit/c0fc23a052e53354a8300dd3f783cb161ae161e1))
101
-
102
- # [@cypress/webpack-dev-server-v1.3.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.3.0...@cypress/webpack-dev-server-v1.3.1) (2021-05-26)
103
-
104
-
105
- ### Bug Fixes
106
-
107
- * encodeURI to correctly load specs with white space ([#16416](https://github.com/cypress-io/cypress/issues/16416)) ([116fe64](https://github.com/cypress-io/cypress/commit/116fe649d74e54da9dd84bf126f08f4b9162c5d3))
108
- * Properly typecheck webpack-dev-server and fix several undefined issues ([#16503](https://github.com/cypress-io/cypress/issues/16503)) ([4bb1ecd](https://github.com/cypress-io/cypress/commit/4bb1ecd077fc3724e6c127982f98e1e6b0f1bb98))
109
-
110
- # [@cypress/webpack-dev-server-v1.3.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.2.0...@cypress/webpack-dev-server-v1.3.0) (2021-05-13)
111
-
112
-
113
- ### Features
114
-
115
- * support webpack dev server v4 ([#16414](https://github.com/cypress-io/cypress/issues/16414)) ([0cea625](https://github.com/cypress-io/cypress/commit/0cea625f359ef554e87600ef7e7c3afa4e36da4d))
116
-
117
- # [@cypress/webpack-dev-server-v1.2.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.6...@cypress/webpack-dev-server-v1.2.0) (2021-05-11)
118
-
119
-
120
- ### Features
121
-
122
- * exclude html pwa plugin in webpack dev server ([#16388](https://github.com/cypress-io/cypress/issues/16388)) ([14c2292](https://github.com/cypress-io/cypress/commit/14c22929badfe56385260a49336cf29e10902470))
123
-
124
- # [@cypress/webpack-dev-server-v1.1.6](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.5...@cypress/webpack-dev-server-v1.1.6) (2021-04-30)
125
-
126
-
127
- ### Bug Fixes
128
-
129
- * update docs ([#16266](https://github.com/cypress-io/cypress/issues/16266)) ([72e064b](https://github.com/cypress-io/cypress/commit/72e064bd0705ae39830a2be2052534699862551a))
130
-
131
- # [@cypress/webpack-dev-server-v1.1.5](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.4...@cypress/webpack-dev-server-v1.1.5) (2021-04-26)
132
-
133
-
134
- ### Bug Fixes
135
-
136
- * **component-testing:** correct imports for relative paths in cypress.json ([#16056](https://github.com/cypress-io/cypress/issues/16056)) ([10b89f8](https://github.com/cypress-io/cypress/commit/10b89f8d587d331256549c3ab7662f119df7a0f1))
137
- * **webpack-dev-server:** remove hard dependency on html-webpack-plugin v4 ([#16108](https://github.com/cypress-io/cypress/issues/16108)) ([4cfe4b1](https://github.com/cypress-io/cypress/commit/4cfe4b1971c615d615c05ce35b9f7dd5ef8315fc))
138
- * remove lazy-compile-webpack-plugin, make html-webpack-plugin a dependency ([#15954](https://github.com/cypress-io/cypress/issues/15954)) ([19136b6](https://github.com/cypress-io/cypress/commit/19136b6a131cffc31899c754cccce64ce1b4fb87))
139
- * run-ct does not hang on windows anymore ([#16022](https://github.com/cypress-io/cypress/issues/16022)) ([6c12a6c](https://github.com/cypress-io/cypress/commit/6c12a6c7b706ee4f708a9d19c62f18cd0838a433))
140
-
141
- # [@cypress/webpack-dev-server-v1.1.4](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.3...@cypress/webpack-dev-server-v1.1.4) (2021-04-21)
142
-
143
-
144
- ### Bug Fixes
145
-
146
- * **webpack:** allow load custom asset on windows ([#16099](https://github.com/cypress-io/cypress/issues/16099)) ([7340851](https://github.com/cypress-io/cypress/commit/7340851097c792ca0d8d3157c3d803dccdd905d2)), closes [#16097](https://github.com/cypress-io/cypress/issues/16097)
147
-
148
- # [@cypress/webpack-dev-server-v1.1.3](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.2...@cypress/webpack-dev-server-v1.1.3) (2021-04-13)
149
-
150
-
151
- ### Bug Fixes
152
-
153
- * ensure root el mounting exists, remove userland html webpack plugin ([#15870](https://github.com/cypress-io/cypress/issues/15870)) ([726120d](https://github.com/cypress-io/cypress/commit/726120da183cb6d89c83181761d21f09844a9fc2))
154
- * make component testing windows compatible ([#15889](https://github.com/cypress-io/cypress/issues/15889)) ([602c762](https://github.com/cypress-io/cypress/commit/602c762cfd707ae497273ac38206d7f9d8545439))
155
- * remove lazy-compile-webpack-plugin ([#15964](https://github.com/cypress-io/cypress/issues/15964)) ([dcf3b14](https://github.com/cypress-io/cypress/commit/dcf3b14f3668cba8e19cf4eecd80db0c726f4248))
156
- * **webpack-dev-server:** remove output.publicPath from webpack-dev-server ([#15839](https://github.com/cypress-io/cypress/issues/15839)) ([8e894a0](https://github.com/cypress-io/cypress/commit/8e894a0fdb899be8dd8993319c9297ea73c10321))
157
-
158
-
159
- ### Reverts
160
-
161
- * Revert "fix: ensure root el mounting exists, remove userland html webpack plugin (#15870)" (#15949) ([1d271ea](https://github.com/cypress-io/cypress/commit/1d271ea209c9d5116d61ed9b147a75eda6a61210)), closes [#15870](https://github.com/cypress-io/cypress/issues/15870) [#15949](https://github.com/cypress-io/cypress/issues/15949)
162
-
163
- # [@cypress/webpack-dev-server-v1.1.2](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.1...@cypress/webpack-dev-server-v1.1.2) (2021-04-06)
164
-
165
-
166
- ### Bug Fixes
167
-
168
- * **component-testing:** Correctly specify @cypress/webpack-dev-server peerDependencies ([#15820](https://github.com/cypress-io/cypress/issues/15820)) ([519b29c](https://github.com/cypress-io/cypress/commit/519b29cb897af59b84dc2f35752f785985348f2d))
169
-
170
- # [@cypress/webpack-dev-server-v1.1.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.1.0...@cypress/webpack-dev-server-v1.1.1) (2021-04-05)
171
-
172
-
173
- ### Bug Fixes
174
-
175
- * **@cypress/react:** Devtools unpredictable resets ([#15612](https://github.com/cypress-io/cypress/issues/15612)) ([b1f831a](https://github.com/cypress-io/cypress/commit/b1f831a86a8bcc6646067bc8a9e67871026ff575)), closes [#15634](https://github.com/cypress-io/cypress/issues/15634)
176
- * **component-testing:** Fix webpack-dev-server deps validation crash ([#15708](https://github.com/cypress-io/cypress/issues/15708)) ([254eb47](https://github.com/cypress-io/cypress/commit/254eb47d91c75a9f56162e7493ab83e5be169935))
177
-
178
- # [@cypress/webpack-dev-server-v1.1.0](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.4...@cypress/webpack-dev-server-v1.1.0) (2021-03-15)
179
-
180
-
181
- ### Bug Fixes
182
-
183
- * **@cypress/react:** Correctly unmount react components ([#15250](https://github.com/cypress-io/cypress/issues/15250)) ([6b515c7](https://github.com/cypress-io/cypress/commit/6b515c777ca2fa599f21dc47d181fd28a7eb6db0))
184
-
185
-
186
- ### Features
187
-
188
- * Use lazy compilation for webpack-dev-server by default ([#15158](https://github.com/cypress-io/cypress/issues/15158)) ([f237050](https://github.com/cypress-io/cypress/commit/f237050fdb49e4e59c07a70bb178d88d0e7387a8))
189
- * webpack stop early when error in run mode ([4ec655b](https://github.com/cypress-io/cypress/commit/4ec655b784ff5f961f1d7ce371c5953d9116c576))
190
-
191
- # [@cypress/webpack-dev-server-v1.0.4](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.3...@cypress/webpack-dev-server-v1.0.4) (2021-03-10)
192
-
193
-
194
- ### Bug Fixes
195
-
196
- * trigger release of the packages ([#15405](https://github.com/cypress-io/cypress/issues/15405)) ([1ce5755](https://github.com/cypress-io/cypress/commit/1ce57554e260850472cf753de68858f47b3f7b3d))
197
-
198
- # [@cypress/webpack-dev-server-v1.0.3](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.2...@cypress/webpack-dev-server-v1.0.3) (2021-02-18)
199
-
200
-
201
- ### Bug Fixes
202
-
203
- * missing index-template.html from package.json deps for webpack-dev-server ([#15151](https://github.com/cypress-io/cypress/issues/15151)) ([36b0440](https://github.com/cypress-io/cypress/commit/36b0440b663c6a0075d23d8d23ae14d47de297c8))
204
-
205
- # [@cypress/webpack-dev-server-v1.0.2](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.1...@cypress/webpack-dev-server-v1.0.2) (2021-02-18)
206
-
207
-
208
- ### Bug Fixes
209
-
210
- * add webpack-dev-server to peerDependencies, improve peerDependency error handling, fix index-template.html path ([#15149](https://github.com/cypress-io/cypress/issues/15149)) ([2863e33](https://github.com/cypress-io/cypress/commit/2863e338920362cbb1ecf20c2fab28fbd3a52c33))
211
-
212
- # [@cypress/webpack-dev-server-v1.0.1](https://github.com/cypress-io/cypress/compare/@cypress/webpack-dev-server-v1.0.0...@cypress/webpack-dev-server-v1.0.1) (2021-02-17)
213
-
214
-
215
- ### Bug Fixes
216
-
217
- * add a trivial change to trigger semantic release ([#15127](https://github.com/cypress-io/cypress/issues/15127)) ([fb7540e](https://github.com/cypress-io/cypress/commit/fb7540e99d56e0cff89aaf2fe76065b9815bdbec))
218
- * trigger semantic release ([#15128](https://github.com/cypress-io/cypress/issues/15128)) ([3a6f3b1](https://github.com/cypress-io/cypress/commit/3a6f3b1928277f7086062b1107f424e5a0247e00))
219
-
220
- # @cypress/webpack-dev-server-v1.0.0 (2021-02-16)
221
-
222
-
223
- ### Features
224
-
225
- * component testing ([#14479](https://github.com/cypress-io/cypress/issues/14479)) ([af26fbe](https://github.com/cypress-io/cypress/commit/af26fbebe6bc609132013a0493a116cc78bb1bd4))