-
-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Use rewrites instead of custom server (#689)
- Loading branch information
1 parent
037543f
commit a956d03
Showing
24 changed files
with
2,046 additions
and
2,048 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ out | |
|
||
# Testing | ||
coverage/ | ||
.e2e | ||
|
||
# npm | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
examples/simple/__tests__/e2e/locale-subpaths-all.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const { nextI18NextRewrites } = require('next-i18next/rewrites') | ||
|
||
const localeSubpaths = { | ||
en: 'en', | ||
de: 'de', | ||
} | ||
|
||
module.exports = { | ||
publicRuntimeConfig: { | ||
localeSubpaths, | ||
}, | ||
experimental: { | ||
async rewrites() { | ||
return [ | ||
...nextI18NextRewrites(localeSubpaths) | ||
] | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
examples/simple/__tests__/e2e/locale-subpaths-foreign.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const { nextI18NextRewrites } = require('next-i18next/rewrites') | ||
|
||
const localeSubpaths = { | ||
de: 'de', | ||
} | ||
|
||
module.exports = { | ||
publicRuntimeConfig: { | ||
localeSubpaths, | ||
}, | ||
experimental: { | ||
async rewrites() { | ||
return [ | ||
...nextI18NextRewrites(localeSubpaths) | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,7 @@ | ||
/* | ||
Do not copy/paste this code. It is used internally | ||
to manage end-to-end test suites. | ||
*/ | ||
|
||
const NextI18Next = require('next-i18next').default | ||
const { localeSubpaths } = require('next/config').default().publicRuntimeConfig | ||
|
||
const localeSubpathVariations = { | ||
none: {}, | ||
foreign: { | ||
de: 'de', | ||
}, | ||
all: { | ||
en: 'en', | ||
de: 'de', | ||
}, | ||
} | ||
|
||
module.exports = new NextI18Next({ | ||
otherLanguages: ['de'], | ||
localeSubpaths: localeSubpathVariations[localeSubpaths], | ||
localeSubpaths, | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
const { nextI18NextRewrites } = require('next-i18next/rewrites') | ||
|
||
const localeSubpaths = {} | ||
|
||
module.exports = { | ||
publicRuntimeConfig: { | ||
localeSubpaths: typeof process.env.LOCALE_SUBPATHS === 'string' | ||
? process.env.LOCALE_SUBPATHS | ||
: 'none', | ||
localeSubpaths, | ||
}, | ||
experimental: { | ||
async rewrites() { | ||
return [ | ||
...nextI18NextRewrites(localeSubpaths) | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.