-
Notifications
You must be signed in to change notification settings - Fork 30k
Fix next/image usage in mdx #64875
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/image usage in mdx #64875
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -819,6 +819,7 @@ export default async function getBaseWebpackConfig( | |
| const shouldIncludeExternalDirs = | ||
| config.experimental.externalDir || !!config.transpilePackages | ||
|
|
||
| const pageExtensionsRegex = new RegExp(`(${pageExtensions.join('|')})$`) | ||
| const codeCondition = { | ||
| test: { or: [/\.(tsx|ts|js|cjs|mjs|jsx)$/, /__barrel_optimize__/] }, | ||
| ...(shouldIncludeExternalDirs | ||
|
|
@@ -840,6 +841,8 @@ export default async function getBaseWebpackConfig( | |
| }, | ||
| } | ||
|
|
||
| const aliasCodeConditionTest = [codeCondition.test, pageExtensionsRegex] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense but why calling it alias-?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| let webpackConfig: webpack.Configuration = { | ||
| parallelism: Number(process.env.NEXT_WEBPACK_PARALLELISM) || undefined, | ||
| ...(isNodeServer ? { externalsPresets: { node: true } } : {}), | ||
|
|
@@ -1326,7 +1329,7 @@ export default async function getBaseWebpackConfig( | |
| // Resolve it if it is a source code file, and it has NOT been | ||
| // opted out of bundling. | ||
| and: [ | ||
| codeCondition.test, | ||
| aliasCodeConditionTest, | ||
| { | ||
| not: [optOutBundlingPackageRegex, asyncStoragesRegex], | ||
| }, | ||
|
|
@@ -1388,7 +1391,7 @@ export default async function getBaseWebpackConfig( | |
| // Resolve it if it is a source code file, and it has NOT been | ||
| // opted out of bundling. | ||
| and: [ | ||
| codeCondition.test, | ||
| aliasCodeConditionTest, | ||
| { | ||
| not: [optOutBundlingPackageRegex, asyncStoragesRegex], | ||
| }, | ||
|
|
@@ -1405,7 +1408,7 @@ export default async function getBaseWebpackConfig( | |
| }, | ||
| }, | ||
| { | ||
| test: codeCondition.test, | ||
| test: aliasCodeConditionTest, | ||
| issuerLayer: WEBPACK_LAYERS.serverSideRendering, | ||
| resolve: { | ||
| alias: createRSCAliases(bundledReactChannel, { | ||
|
|
@@ -1418,7 +1421,7 @@ export default async function getBaseWebpackConfig( | |
| ], | ||
| }, | ||
| { | ||
| test: codeCondition.test, | ||
| test: aliasCodeConditionTest, | ||
| issuerLayer: WEBPACK_LAYERS.appPagesBrowser, | ||
| resolve: { | ||
| alias: createRSCAliases(bundledReactChannel, { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import Image from 'next/image' | ||
|
|
||
| # Title | ||
|
|
||
| This is a markdown page | ||
|
|
||
| <Image src="/test.jpg" alt="Next.js Logo" width={180} height={37} /> |
Uh oh!
There was an error while loading. Please reload this page.