You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building a NextJS app (14.0.4) and trying to use @valtown/codemirror-ts, but I get the following errors:
# this is from the worker
./node_modules/@typescript/vfs/dist/vfs.esm.js
Critical dependency: the request of a dependency is an expression
# this is from React code
./node_modules/typescript/lib/typescript.js
Critical dependency: the request of a dependency is an expression
use transpilePackages: ["typescript"] in next.config.js
started editing @valtown/codemirror-ts to not include any imports from typescript, and while that seems to help avoid the issue, it's not a scalable solution
tried the non-worker version, but the same error appears
It really seems like it doesn't like importing typescript, so I was wondering if you had any tips to overcome this issue.
Looks like this is an upstream bug in Webpack+TypeScript and there's a thread on the TypeScript repo: microsoft/TypeScript#39436
It looks like there are some proposed solutions there, plus a PR that was merged that should fix it in recent TypeScript releases.
abstractalgo
changed the title
Error: Critical dependency: the request of a dependency is an expression
NextJS - Error: Critical dependency: the request of a dependency is an expression
Feb 10, 2024
abstractalgo
changed the title
NextJS - Error: Critical dependency: the request of a dependency is an expression
Error: Critical dependency: the request of a dependency is an expression (NextJS/Webpack)
Feb 10, 2024
Many StackBlitz/CodeSandbox examples use a similar @typescript/vfs setup, but bundle with Vite or Remix, which don't have this issue -- this indeed seems like a NextJS/Webpack-specific issue. I'll consider alternative setups for the time being (feel free to resolve this Github issue). Thanks for your help!
I'm building a NextJS app (14.0.4) and trying to use
@valtown/codemirror-ts
, but I get the following errors:I tried:
typescript
module:transpilePackages: ["typescript"]
innext.config.js
@valtown/codemirror-ts
to not include any imports fromtypescript
, and while that seems to help avoid the issue, it's not a scalable solutionIt really seems like it doesn't like importing
typescript
, so I was wondering if you had any tips to overcome this issue.React code
Worker
The text was updated successfully, but these errors were encountered: