Commit 130c086 Barthélémy Ledoux
authored
1 parent 6c8f3a2 commit 130c086 Copy full SHA for 130c086
File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1
1
// @ts -check
2
2
/// <reference types="next" />
3
3
const debug = require ( 'debug' ) ( '@cypress/react' )
4
- const loadConfig = require ( 'next/dist/next-server/server/config' ) . default
5
4
const getNextJsBaseWebpackConfig = require ( 'next/dist/build/webpack-config' ) . default
6
5
7
6
async function getNextWebpackConfig ( config ) {
7
+ let loadConfig
8
+
9
+ try {
10
+ loadConfig = require ( 'next/dist/next-server/server/config' ) . default
11
+ } catch ( e ) {
12
+ if ( e . code === 'MODULE_NOT_FOUND' ) {
13
+ // Starting from 11.0.2-canary.23, the server config file
14
+ // is not in the next-server folder anymore.
15
+ // @ts -ignore
16
+ loadConfig = require ( 'next/dist/server/config' ) . default
17
+ }
18
+
19
+ throw e
20
+ }
8
21
const nextConfig = await loadConfig ( 'development' , config . projectRoot )
9
22
const nextWebpackConfig = await getNextJsBaseWebpackConfig (
10
23
config . projectRoot ,
You can’t perform that action at this time.
0 commit comments