@cypress/webpack-dev-server 3.4.0 → 3.4.1
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/dist/helpers/nextHandler.js +17 -4
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ exports.nextHandler = nextHandler;
|
|
|
25
25
|
* `getNextJsBaseWebpackConfig` acquires the webpackConfig dependent on the next.config.js
|
|
26
26
|
*/
|
|
27
27
|
function getNextJsPackages(devServerConfig) {
|
|
28
|
-
var _a, _b, _c;
|
|
28
|
+
var _a, _b, _c, _d, _e;
|
|
29
29
|
const resolvePaths = { paths: [devServerConfig.cypressConfig.projectRoot] };
|
|
30
30
|
const packages = {};
|
|
31
31
|
try {
|
|
@@ -49,6 +49,14 @@ function getNextJsPackages(devServerConfig) {
|
|
|
49
49
|
catch (e) {
|
|
50
50
|
throw new Error(`Failed to load "next/dist/build/load-jsconfig" with error: ${(_c = e.message) !== null && _c !== void 0 ? _c : e}`);
|
|
51
51
|
}
|
|
52
|
+
// Does not exist prior to Next 13.
|
|
53
|
+
try {
|
|
54
|
+
const getUtilsPath = require.resolve('next/dist/build/utils', resolvePaths);
|
|
55
|
+
packages.getSupportedBrowsers = (_d = require(getUtilsPath).getSupportedBrowsers) !== null && _d !== void 0 ? _d : (() => Promise.resolve([]));
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
throw new Error(`Failed to load "next/dist/build/utils" with error: ${(_e = e.message) !== null && _e !== void 0 ? _e : e}`);
|
|
59
|
+
}
|
|
52
60
|
return packages;
|
|
53
61
|
}
|
|
54
62
|
/**
|
|
@@ -166,11 +174,12 @@ function getNextJsPackages(devServerConfig) {
|
|
|
166
174
|
]
|
|
167
175
|
*/
|
|
168
176
|
async function loadWebpackConfig(devServerConfig) {
|
|
169
|
-
const { loadConfig, getNextJsBaseWebpackConfig, nextLoadJsConfig } = getNextJsPackages(devServerConfig);
|
|
177
|
+
const { loadConfig, getNextJsBaseWebpackConfig, nextLoadJsConfig, getSupportedBrowsers } = getNextJsPackages(devServerConfig);
|
|
170
178
|
const nextConfig = await loadConfig('development', devServerConfig.cypressConfig.projectRoot);
|
|
171
179
|
const runWebpackSpan = getRunWebpackSpan(devServerConfig);
|
|
172
180
|
const reactVersion = getReactVersion(devServerConfig.cypressConfig.projectRoot);
|
|
173
181
|
const jsConfigResult = await (nextLoadJsConfig === null || nextLoadJsConfig === void 0 ? void 0 : nextLoadJsConfig(devServerConfig.cypressConfig.projectRoot, nextConfig));
|
|
182
|
+
const supportedBrowsers = await getSupportedBrowsers(devServerConfig.cypressConfig.projectRoot, true, nextConfig);
|
|
174
183
|
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), {
|
|
175
184
|
// Client webpack config for Next.js <= 12.1.5
|
|
176
185
|
isServer: false,
|
|
@@ -178,8 +187,12 @@ async function loadWebpackConfig(devServerConfig) {
|
|
|
178
187
|
compilerType: 'client',
|
|
179
188
|
// Required for Next.js > 13
|
|
180
189
|
hasReactRoot: reactVersion === 18,
|
|
181
|
-
// Required for Next.js > 13.2.
|
|
182
|
-
jsConfig: jsConfigResult.jsConfig
|
|
190
|
+
// Required for Next.js > 13.2.0 to respect TS/JS config
|
|
191
|
+
jsConfig: jsConfigResult.jsConfig,
|
|
192
|
+
// Required for Next.js > 13.2.0 to respect tsconfig.compilerOptions.baseUrl
|
|
193
|
+
resolvedBaseUrl: jsConfigResult.resolvedBaseUrl,
|
|
194
|
+
// Added in Next.js 13, passed via `...info`: https://github.com/vercel/next.js/pull/45637/files
|
|
195
|
+
supportedBrowsers }));
|
|
183
196
|
return webpackConfig;
|
|
184
197
|
}
|
|
185
198
|
/**
|