MDX/Turbopack support
Answered
Sphecid wasp posted this in #help-forum
Sphecid waspOP
Hey guys I am trying to folow this example here:
https://nextjs.org/docs/pages/building-your-application/configuring/mdx#using-plugins-with-turbopack
When I pass imported functions it works as expected but throws:
When I pass strings as in the doc TS compiler throws that strings are not supported and build fails. Is the doc out of date? Is there a way to use mdx with turbo?
https://nextjs.org/docs/pages/building-your-application/configuring/mdx#using-plugins-with-turbopack
When I pass imported functions it works as expected but throws:
(node:39353) ExperimentalWarning: CommonJS module /Volumes/Data/Projects/bldry-website/next.config.compiled.js is loading ES Module /Volumes/Data/Projects/bldry-website/node_modules/rehype-external-links/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
When I pass strings as in the doc TS compiler throws that strings are not supported and build fails. Is the doc out of date? Is there a way to use mdx with turbo?
Answered by Sphecid wasp
Full stacktrace
Pointless, created an issue and removed MDX from my codebase.
Takeaway: don't use MDX with Next.
(node:40939) ExperimentalWarning: CommonJS module /Volumes/Data/Projects/bldry-website/next.config.compiled.js is loading ES Module /Volumes/Data/Projects/bldry-website/node_modules/remark-breaks/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
at require (node:internal/modules/helpers:138:16)
at Object.<anonymous> (/Volumes/Data/Projects/bldry-website/next.config.compiled.js:15:60)
at Module._compile (node:internal/modules/cjs/loader:1565:14)
at requireFromString (/Volumes/Data/Projects/bldry-website/node_modules/next/dist/build/next-config-ts/require-hook.js:81:7)
at transpileConfig (/Volumes/Data/Projects/bldry-website/node_modules/next/dist/build/next-config-ts/transpile-config.js:63:51)
at async loadConfig (/Volumes/Data/Projects/bldry-website/node_modules/next/dist/server/config.js:771:36)
at async getStartServerInfo (/Volumes/Data/Projects/bldry-website/node_modules/next/dist/server/lib/app-info-log.js:93:5)
at async Server.<anonymous> (/Volumes/Data/Projects/bldry-website/node_modules/next/dist/server/lib/start-server.js:220:41)
Pointless, created an issue and removed MDX from my codebase.
Takeaway: don't use MDX with Next.
1 Reply
Sphecid waspOP
Full stacktrace
Pointless, created an issue and removed MDX from my codebase.
Takeaway: don't use MDX with Next.
(node:40939) ExperimentalWarning: CommonJS module /Volumes/Data/Projects/bldry-website/next.config.compiled.js is loading ES Module /Volumes/Data/Projects/bldry-website/node_modules/remark-breaks/index.js using require().
Support for loading ES Module in require() is an experimental feature and might change at any time
at require (node:internal/modules/helpers:138:16)
at Object.<anonymous> (/Volumes/Data/Projects/bldry-website/next.config.compiled.js:15:60)
at Module._compile (node:internal/modules/cjs/loader:1565:14)
at requireFromString (/Volumes/Data/Projects/bldry-website/node_modules/next/dist/build/next-config-ts/require-hook.js:81:7)
at transpileConfig (/Volumes/Data/Projects/bldry-website/node_modules/next/dist/build/next-config-ts/transpile-config.js:63:51)
at async loadConfig (/Volumes/Data/Projects/bldry-website/node_modules/next/dist/server/config.js:771:36)
at async getStartServerInfo (/Volumes/Data/Projects/bldry-website/node_modules/next/dist/server/lib/app-info-log.js:93:5)
at async Server.<anonymous> (/Volumes/Data/Projects/bldry-website/node_modules/next/dist/server/lib/start-server.js:220:41)
Pointless, created an issue and removed MDX from my codebase.
Takeaway: don't use MDX with Next.
Answer