deno
deno copied to clipboard
fix: add suggestion how to fix importing CJS module
trafficstars
Similar mechanism can be used to fix https://github.com/denoland/deno/issues/21712
Really like the idea of providing suggestions.
Here's a little more real-worldy next config: https://github.com/timlrx/tailwind-nextjs-starter-blog/blob/main/next.config.js
Ideally Deno could provide suggestions for migration:
| const { withContentlayer } = require('next-contentlayer')
^^^^^^^
Deno doesn't support CommonJS in user code, that is, outside of npm modules.
hint: use `import { withContentLayer } from "next-contentlayer"`;
| const withBundleAnalyzer = require('@next/bundle-analyzer')({
^^^^^^^
Deno doesn't support CommonJS in user code, that is, outside of npm modules.
hint: use:
import $ from "@next/bundle-analyzer";
const withBundleAnalyzer = $({
enabled: process.env.ANALYZE === 'true',
});
Ideally Deno could provide suggestions for migration:
being able to have a CLI option to autofix given hint would really be helpful.
Update the error message and land, but first do https://github.com/denoland/deno/issues/25384