@cypress/webpack-dev-server 3.2.3 → 3.2.4

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.
@@ -7,6 +7,7 @@ export interface CypressCTWebpackPluginOptions {
7
7
  supportFile: string | false;
8
8
  devServerEvents: EventEmitter;
9
9
  webpack: Function;
10
+ indexHtmlFile: string;
10
11
  }
11
12
  export declare type CypressCTContextOptions = Omit<CypressCTWebpackPluginOptions, 'devServerEvents' | 'webpack'>;
12
13
  export interface CypressCTWebpackContext {
@@ -23,6 +23,7 @@ class CypressCTWebpackPlugin {
23
23
  files: this.files,
24
24
  projectRoot: this.projectRoot,
25
25
  supportFile: this.supportFile,
26
+ indexHtmlFile: this.indexHtmlFile,
26
27
  };
27
28
  };
28
29
  this.beforeCompile = async (compilationParams, callback) => {
@@ -45,11 +46,16 @@ class CypressCTWebpackPlugin {
45
46
  callback();
46
47
  };
47
48
  /*
48
- * `webpack --watch` watches the existing specs and their dependencies for changes,
49
- * but we also need to add additional dependencies to our dynamic "browser.js" (generated
50
- * using loader.ts) when new specs are created. This hook informs webpack that browser.js
51
- * has been "updated on disk", causing a recompliation (and pulling the new specs in as
52
- * dependencies).
49
+ * `webpack --watch` watches the existing specs and their dependencies for changes.
50
+ * When new specs are created, we need to trigger a recompilation to add the new specs
51
+ * as dependencies. This hook informs webpack that `component-index.html` has been "updated on disk",
52
+ * causing a recompilation (and pulling the new specs in as dependencies). We use the component
53
+ * index file because we know that it will be there since the project is using Component Testing.
54
+ *
55
+ * We were using `browser.js` before to cause a recompilation but we ran into an
56
+ * issue with MacOS Ventura that will not allow us to write to files inside of our application bundle.
57
+ *
58
+ * See https://github.com/cypress-io/cypress/issues/24398
53
59
  */
54
60
  this.onSpecsChange = async (specs) => {
55
61
  var _a;
@@ -61,7 +67,7 @@ class CypressCTWebpackPlugin {
61
67
  // TODO: don't use a sync fs method here
62
68
  // eslint-disable-next-line no-restricted-syntax
63
69
  const utimesSync = (_a = inputFileSystem.fileSystem.utimesSync) !== null && _a !== void 0 ? _a : fs_extra_1.default.utimesSync;
64
- utimesSync(path_1.default.resolve(__dirname, 'browser.js'), new Date(), new Date());
70
+ utimesSync(path_1.default.join(this.projectRoot, this.indexHtmlFile), new Date(), new Date());
65
71
  };
66
72
  /**
67
73
  * The webpack compiler generates a new `compilation` each time it compiles, so
@@ -88,6 +94,7 @@ class CypressCTWebpackPlugin {
88
94
  this.projectRoot = options.projectRoot;
89
95
  this.devServerEvents = options.devServerEvents;
90
96
  this.webpack = options.webpack;
97
+ this.indexHtmlFile = options.indexHtmlFile;
91
98
  }
92
99
  /**
93
100
  * The plugin's entrypoint, called once by webpack when the compiler is initialized.
@@ -49,6 +49,7 @@ function makeCypressWebpackConfig(config) {
49
49
  devServerEvents,
50
50
  supportFile,
51
51
  webpack,
52
+ indexHtmlFile,
52
53
  }),
53
54
  ],
54
55
  devtool: 'inline-source-map',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cypress/webpack-dev-server",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
4
4
  "description": "Launches Webpack Dev Server for Component Testing",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {