Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(next): always enable absoluteRuntime when running under webpack #19538

Merged
merged 2 commits into from Jan 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/next/build/babel/preset.ts
Expand Up @@ -77,6 +77,10 @@ module.exports = (
// Default to production mode if not `test` nor `development`:
const isProduction = !(isTest || isDevelopment)

const isBabelLoader = api.caller(
(caller: any) => !!caller && caller.name === 'babel-loader'
)

const useJsxRuntime =
options['preset-react']?.runtime === 'automatic' ||
(Boolean(api.caller((caller: any) => !!caller && caller.hasJsxRuntime)) &&
Expand Down Expand Up @@ -180,7 +184,7 @@ module.exports = (
helpers: true,
regenerator: true,
useESModules: supportsESM && presetEnvConfig.modules !== 'commonjs',
absoluteRuntime: process.versions.pnp
absoluteRuntime: isBabelLoader
? dirname(require.resolve('@babel/runtime/package.json'))
: undefined,
...options['transform-runtime'],
Expand Down