Unverified Commit a92e9762 authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Remove remaining granular chunks references (#13672)

This removes remaining references to `granularChunks` in configs, error messages, and comments.

Also removed the `process.env.__NEXT_GRANULAR_CHUNKS` value.

---

Follow up to: https://github.com/vercel/next.js/pull/13663
parent 0769a82a
...@@ -141,7 +141,7 @@ export function createEntrypoints( ...@@ -141,7 +141,7 @@ export function createEntrypoints(
pageLoaderOpts pageLoaderOpts
)}!` )}!`
// Make sure next/router is a dependency of _app or else granularChunks // Make sure next/router is a dependency of _app or else chunk splitting
// might cause the router to not be able to load causing hydration // might cause the router to not be able to load causing hydration
// to fail // to fail
......
...@@ -827,7 +827,6 @@ export default async function getBaseWebpackConfig( ...@@ -827,7 +827,6 @@ export default async function getBaseWebpackConfig(
'process.env.__NEXT_MODERN_BUILD': JSON.stringify( 'process.env.__NEXT_MODERN_BUILD': JSON.stringify(
config.experimental.modern && !dev config.experimental.modern && !dev
), ),
'process.env.__NEXT_GRANULAR_CHUNKS': JSON.stringify(!dev),
'process.env.__NEXT_BUILD_INDICATOR': JSON.stringify( 'process.env.__NEXT_BUILD_INDICATOR': JSON.stringify(
config.devIndicators.buildActivity config.devIndicators.buildActivity
), ),
......
...@@ -17,8 +17,8 @@ export interface GranularChunksConformanceCheck ...@@ -17,8 +17,8 @@ export interface GranularChunksConformanceCheck
function getWarningMessage(modifiedProp: string) { function getWarningMessage(modifiedProp: string) {
return ( return (
`${CONFORMANCE_WARNING_PREFIX}: The splitChunks config as part of the granularChunks flag has ` + `${CONFORMANCE_WARNING_PREFIX}: The splitChunks config has been carefully ` +
`been carefully crafted to optimize build size and build times. Modifying - ${chalk.bold( `crafted to optimize build size and build times. Modifying - ${chalk.bold(
modifiedProp modifiedProp
)} could result in slower builds and increased code duplication` )} could result in slower builds and increased code duplication`
) )
...@@ -26,8 +26,8 @@ function getWarningMessage(modifiedProp: string) { ...@@ -26,8 +26,8 @@ function getWarningMessage(modifiedProp: string) {
function getErrorMessage(message: string) { function getErrorMessage(message: string) {
return ( return (
`${CONFORMANCE_ERROR_PREFIX}: The splitChunks config as part of the granularChunks flag has ` + `${CONFORMANCE_ERROR_PREFIX}: The splitChunks config has been carefully ` +
`been carefully crafted to optimize build size and build times. Please avoid changes to ${chalk.bold( `crafted to optimize build size and build times. Please avoid changes to ${chalk.bold(
message message
)}` )}`
) )
......
...@@ -57,7 +57,7 @@ export default class PageLoader { ...@@ -57,7 +57,7 @@ export default class PageLoader {
this.pageCache = {} this.pageCache = {}
this.pageRegisterEvents = mitt() this.pageRegisterEvents = mitt()
this.loadingRoutes = {} this.loadingRoutes = {}
if (process.env.__NEXT_GRANULAR_CHUNKS) { if (process.env.NODE_ENV === 'production') {
this.promisedBuildManifest = new Promise((resolve) => { this.promisedBuildManifest = new Promise((resolve) => {
if (window.__BUILD_MANIFEST) { if (window.__BUILD_MANIFEST) {
resolve(window.__BUILD_MANIFEST) resolve(window.__BUILD_MANIFEST)
...@@ -215,7 +215,7 @@ export default class PageLoader { ...@@ -215,7 +215,7 @@ export default class PageLoader {
if (!this.loadingRoutes[route]) { if (!this.loadingRoutes[route]) {
this.loadingRoutes[route] = true this.loadingRoutes[route] = true
if (process.env.__NEXT_GRANULAR_CHUNKS) { if (process.env.NODE_ENV === 'production') {
this.getDependencies(route).then((deps) => { this.getDependencies(route).then((deps) => {
deps.forEach((d) => { deps.forEach((d) => {
if ( if (
...@@ -348,7 +348,7 @@ export default class PageLoader { ...@@ -348,7 +348,7 @@ export default class PageLoader {
relPrefetch, relPrefetch,
url.match(/\.css$/) ? 'style' : 'script' url.match(/\.css$/) ? 'style' : 'script'
), ),
process.env.__NEXT_GRANULAR_CHUNKS && process.env.NODE_ENV === 'production' &&
!isDependency && !isDependency &&
this.getDependencies(route).then((urls) => this.getDependencies(route).then((urls) =>
Promise.all( Promise.all(
......
...@@ -112,8 +112,7 @@ module.exports = { ...@@ -112,8 +112,7 @@ module.exports = {
return config return config
}, },
experimental: { experimental: {
modern: true, modern: true
granularChunks: true
} }
} }
`, `,
...@@ -128,8 +127,7 @@ module.exports = { ...@@ -128,8 +127,7 @@ module.exports = {
module.exports = { module.exports = {
generateBuildId: () => 'BUILD_ID', generateBuildId: () => 'BUILD_ID',
experimental: { experimental: {
modern: true, modern: true
granularChunks: true
} }
} }
`, `,
...@@ -164,8 +162,7 @@ module.exports = { ...@@ -164,8 +162,7 @@ module.exports = {
generateBuildId: () => 'BUILD_ID', generateBuildId: () => 'BUILD_ID',
target: 'serverless', target: 'serverless',
experimental: { experimental: {
modern: true, modern: true
granularChunks: true
} }
} }
`, `,
......
...@@ -139,7 +139,7 @@ describe('Chunking', () => { ...@@ -139,7 +139,7 @@ describe('Chunking', () => {
afterAll(() => stopApp(server)) afterAll(() => stopApp(server))
it('should hydrate with granularChunks config', async () => { it('should hydrate with aggressive chunking', async () => {
const browser = await webdriver(appPort, '/page2') const browser = await webdriver(appPort, '/page2')
const text = await browser.elementByCss('#padded-str').text() const text = await browser.elementByCss('#padded-str').text()
......
...@@ -30,11 +30,11 @@ describe('Conformance system', () => { ...@@ -30,11 +30,11 @@ describe('Conformance system', () => {
) )
}) })
it('Should warn about changes to granularChunks config', async () => { it('Should warn about changes to splitChunks config', async () => {
const { stderr } = build const { stderr } = build
expect(stderr).toContain( expect(stderr).toContain(
'[BUILD CONFORMANCE ERROR]: The splitChunks config as part of the granularChunks flag has ' + '[BUILD CONFORMANCE ERROR]: The splitChunks config has been carefully ' +
`been carefully crafted to optimize build size and build times. Please avoid changes to ${chalk.bold( `crafted to optimize build size and build times. Please avoid changes to ${chalk.bold(
'splitChunks.cacheGroups.vendors' 'splitChunks.cacheGroups.vendors'
)}` )}`
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment