Enable "paths" support by default (#11970)
* Enable "paths" support by default * Enable NEXT_PUBLIC_ prefix exposing the variable globally Part of #11106
This commit is contained in:
parent
26df01800d
commit
511cf748ee
5 changed files with 10 additions and 25 deletions
|
@ -768,17 +768,15 @@ export default async function getBaseWebpackConfig(
|
|||
// This plugin makes sure `output.filename` is used for entry chunks
|
||||
new ChunkNamesPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
...(config.experimental.pageEnv
|
||||
? Object.keys(process.env).reduce(
|
||||
(prev: { [key: string]: string }, key: string) => {
|
||||
if (key.startsWith('NEXT_PUBLIC_')) {
|
||||
prev[`process.env.${key}`] = JSON.stringify(process.env[key]!)
|
||||
}
|
||||
return prev
|
||||
},
|
||||
{}
|
||||
)
|
||||
: {}),
|
||||
...Object.keys(process.env).reduce(
|
||||
(prev: { [key: string]: string }, key: string) => {
|
||||
if (key.startsWith('NEXT_PUBLIC_')) {
|
||||
prev[`process.env.${key}`] = JSON.stringify(process.env[key]!)
|
||||
}
|
||||
return prev
|
||||
},
|
||||
{}
|
||||
),
|
||||
...Object.keys(config.env).reduce((acc, key) => {
|
||||
if (/^(?:NODE_.+)|^(?:__.+)$/i.test(key)) {
|
||||
throw new Error(
|
||||
|
@ -1005,11 +1003,7 @@ export default async function getBaseWebpackConfig(
|
|||
webpackConfig.resolve?.modules?.push(resolvedBaseUrl)
|
||||
}
|
||||
|
||||
if (
|
||||
config.experimental.jsconfigPaths &&
|
||||
jsConfig?.compilerOptions?.paths &&
|
||||
resolvedBaseUrl
|
||||
) {
|
||||
if (jsConfig?.compilerOptions?.paths && resolvedBaseUrl) {
|
||||
webpackConfig.resolve?.plugins?.push(
|
||||
new JsConfigPathsPlugin(jsConfig.compilerOptions.paths, resolvedBaseUrl)
|
||||
)
|
||||
|
|
|
@ -41,7 +41,6 @@ const defaultConfig: { [key: string]: any } = {
|
|||
(Number(process.env.CIRCLE_NODE_TOTAL) ||
|
||||
(os.cpus() || { length: 1 }).length) - 1
|
||||
),
|
||||
jsconfigPaths: false,
|
||||
css: true,
|
||||
scss: true,
|
||||
documentMiddleware: false,
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
module.exports = {
|
||||
experimental: {
|
||||
pageEnv: true,
|
||||
|
||||
async redirects() {
|
||||
return [
|
||||
{
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
module.exports = {
|
||||
experimental: {
|
||||
jsconfigPaths: true,
|
||||
},
|
||||
onDemandEntries: {
|
||||
// Make sure entries are not getting disposed.
|
||||
maxInactiveAge: 1000 * 60 * 60,
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
module.exports = {
|
||||
experimental: {
|
||||
jsconfigPaths: true,
|
||||
},
|
||||
onDemandEntries: {
|
||||
// Make sure entries are not getting disposed.
|
||||
maxInactiveAge: 1000 * 60 * 60,
|
||||
|
|
Loading…
Reference in a new issue