Skip to content

Commit

Permalink
webpack5 testing
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Dec 31, 2020
1 parent 8907a01 commit 87438a0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_test_deploy.yml
Expand Up @@ -144,11 +144,11 @@ jobs:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
HEADLESS: true
NEXT_WEBPACK5: 1

steps:
- uses: actions/checkout@v2
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- run: cat package.json | jq '.resolutions.webpack = "^5.11.1"' > package.json.tmp && mv package.json.tmp package.json
- run: cat package.json | jq '.resolutions.react = "^17.0.1"' > package.json.tmp && mv package.json.tmp package.json
- run: cat package.json | jq '.resolutions."react-dom" = "^17.0.1"' > package.json.tmp && mv package.json.tmp package.json
- run: yarn install --check-files
Expand Down
2 changes: 0 additions & 2 deletions packages/next/build/index.ts
Expand Up @@ -402,7 +402,6 @@ export default async function build(
pagesDir,
entrypoints: entrypoints.client,
rewrites,
webpack5: false,
}),
getBaseWebpackConfig(dir, {
tracer: chromeProfiler,
Expand All @@ -414,7 +413,6 @@ export default async function build(
pagesDir,
entrypoints: entrypoints.server,
rewrites,
webpack5: false,
}),
])

Expand Down
7 changes: 4 additions & 3 deletions packages/next/build/webpack-config.ts
Expand Up @@ -194,7 +194,6 @@ export default async function getBaseWebpackConfig(
reactProductionProfiling = false,
entrypoints,
rewrites,
webpack5 = false,
}: {
buildId: string
config: NextConfig
Expand All @@ -206,10 +205,12 @@ export default async function getBaseWebpackConfig(
reactProductionProfiling?: boolean
entrypoints: WebpackEntrypoints
rewrites: Rewrite[]
webpack5: boolean
}
): Promise<webpack.Configuration> {
initWebpack(webpack5)
initWebpack(
config.future?.webpack5 ||
(config.future?.webpack5 !== false && Number(process.env.NEXT_WEBPACK5))
)

const productionBrowserSourceMaps =
config.productionBrowserSourceMaps && !isServer
Expand Down
1 change: 1 addition & 0 deletions packages/next/next-server/server/config.ts
Expand Up @@ -84,6 +84,7 @@ const defaultConfig: NextConfig = {
},
future: {
excludeDefaultMomentLocales: false,
webpack5: false,
},
serverRuntimeConfig: {},
publicRuntimeConfig: {},
Expand Down
2 changes: 0 additions & 2 deletions packages/next/server/hot-reloader.ts
Expand Up @@ -308,7 +308,6 @@ export default class HotReloader {
pagesDir: this.pagesDir,
rewrites: this.rewrites,
entrypoints: { ...entrypoints.client, ...additionalClientEntrypoints },
webpack5: false,
}),
getBaseWebpackConfig(this.dir, {
dev: true,
Expand All @@ -318,7 +317,6 @@ export default class HotReloader {
pagesDir: this.pagesDir,
rewrites: this.rewrites,
entrypoints: entrypoints.server,
webpack5: false,
}),
])
}
Expand Down

0 comments on commit 87438a0

Please sign in to comment.