Skip to content

Commit

Permalink
wip pnp
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottsj committed Jan 16, 2021
1 parent 02e3510 commit f4a47b4
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions packages/next/build/webpack-config.ts
Expand Up @@ -426,25 +426,27 @@ export default async function getBaseWebpackConfig(
)
}

const getPackagePath = (name: string, contextDirectory: string) => {
const getPackagePath = (name: string, relativeToPath: string) => {
const packageJsonPath = require.resolve(`${name}/package.json`, {
paths: [contextDirectory],
paths: [relativeToPath],
})
return path.dirname(packageJsonPath)
}

const nextPackagePath = getPackagePath('next', dir)
const reactPackagePath = getPackagePath('react', dir)
// const nextPackageMainPath = require.resolve('next', { paths: [dir] });

// Packages which will be split into the 'framework' chunk.
// Only top-level packages are included, e.g. nested copies like
// 'node_modules/react-scroll-parallax/node_modules/prop-types' are not included.
const topLevelFrameworkPaths = [
reactPackagePath,
getPackagePath('react', dir),
getPackagePath('react-dom', dir),
getPackagePath('scheduler', reactPackagePath),
getPackagePath('prop-types', nextPackagePath),
getPackagePath('use-subscription', nextPackagePath),
getPackagePath('scheduler', require.resolve('react', { paths: [dir] })),
getPackagePath('prop-types', require.resolve('next', { paths: [dir] })),
getPackagePath(
'use-subscription',
require.resolve('next', { paths: [dir] })
),
]

// Contains various versions of the Webpack SplitChunksPlugin used in different build types
Expand Down

0 comments on commit f4a47b4

Please sign in to comment.