fuse icon indicating copy to clipboard operation
fuse copied to clipboard

Bug: webpack parse error in Next.js

Open mxstbr opened this issue 1 year ago • 1 comments

Description

Using Fuse with Next.js, when I run next dev I get an ugly parse error in my terminal despite everything looking like it works fine:

yarn dev
yarn run v1.22.17
$ next dev
   ▲ Next.js 14.0.5-canary.41
   - Local:        http://localhost:3000
   - Environments: .env.local
   - Experiments (use at your own risk):
     · ppr

   automatically enabled Fast Refresh for 1 custom loader
 ✓ Ready in 1880ms
 ○ Compiling /api/fuse ...
 ✓ Compiled /api/fuse in 1177ms (636 modules)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/codegen.js for build dependencies failed at 'import(isESMModule
<w>             ? /**
<w>                * For ESM we currently have no "resolve path" solution
<w>                * as import.meta is unavailable in a CommonJS context
<w>                * and furthermore unavailable in stable Node.js.
<w>                **/
<w>                 mod
<w>             : relativeRequire.resolve(mod))'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/config.js for build dependencies failed at 'import(relativeRequire.resolve(mod, {
<w>             paths: [process.cwd()],
<w>         }))'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@graphql-tools/url-loader/esm/index.js for build dependencies failed at 'import(`${moduleName}`)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/load/esm/load-typedefs/collect-sources.js for build dependencies failed at 'import(m)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/code-file-loader/esm/index.js for build dependencies failed at 'import(m)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/code-file-loader/esm/load-from-module.js for build dependencies failed at 'import(filepath)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'svelte2tsx' in '/Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/graphql-tag-pluck/esm'
<w> while resolving 'svelte2tsx' in /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/graphql-tag-pluck/esm as file
<w>  at resolve esm file svelte2tsx
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/graphql-tag-pluck/esm/index.js
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/graphql-tag-pluck/esm/index.js
<w>  at resolve esm file @graphql-tools/graphql-tag-pluck
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/code-file-loader/esm/index.js
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/code-file-loader/esm/index.js
<w>  at resolve esm file @graphql-tools/code-file-loader
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/load.js
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/load.js
<w>  at resolve esm file ./load.js
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/config.js
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/config.js
<w>  at resolve esm file ./config.js
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/index.js
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/index.js
<w>  at resolve esm file @graphql-codegen/cli
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/fuse/dist/next/plugin.mjs
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/fuse/dist/next/plugin.mjs
<w>  at resolve esm file fuse/next/plugin
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/next.config.mjs
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/next.config.mjs
<w>  at resolve commonjs /Users/mxstbr/projects/rauchg/next-ai-news/next.config.mjs
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/codegen.js for build dependencies failed at 'import(isESMModule
<w>             ? /**
<w>                * For ESM we currently have no "resolve path" solution
<w>                * as import.meta is unavailable in a CommonJS context
<w>                * and furthermore unavailable in stable Node.js.
<w>                **/
<w>                 mod
<w>             : relativeRequire.resolve(mod))'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/config.js for build dependencies failed at 'import(relativeRequire.resolve(mod, {
<w>             paths: [process.cwd()],
<w>         }))'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@graphql-tools/url-loader/esm/index.js for build dependencies failed at 'import(`${moduleName}`)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/load/esm/load-typedefs/collect-sources.js for build dependencies failed at 'import(m)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/code-file-loader/esm/index.js for build dependencies failed at 'import(m)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Parsing of /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/code-file-loader/esm/load-from-module.js for build dependencies failed at 'import(filepath)'.
<w> Build dependencies behind this expression are ignored and might cause incorrect cache invalidation.
<w> [webpack.cache.PackFileCacheStrategy] Caching failed for pack: Error: Can't resolve 'svelte2tsx' in '/Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/graphql-tag-pluck/esm'
<w> while resolving 'svelte2tsx' in /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/graphql-tag-pluck/esm as file
<w>  at resolve esm file svelte2tsx
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/graphql-tag-pluck/esm/index.js
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/graphql-tag-pluck/esm/index.js
<w>  at resolve esm file @graphql-tools/graphql-tag-pluck
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/code-file-loader/esm/index.js
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected][email protected]/node_modules/@graphql-tools/code-file-loader/esm/index.js
<w>  at resolve esm file @graphql-tools/code-file-loader
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/load.js
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/load.js
<w>  at resolve esm file ./load.js
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/config.js
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/config.js
<w>  at resolve esm file ./config.js
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/index.js
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/@graphql-codegen/cli/esm/index.js
<w>  at resolve esm file @graphql-codegen/cli
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/fuse/dist/next/plugin.mjs
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/fuse/dist/next/plugin.mjs
<w>  at resolve esm file fuse/next/plugin
<w>  at file dependencies /Users/mxstbr/projects/rauchg/next-ai-news/next.config.mjs
<w>  at file /Users/mxstbr/projects/rauchg/next-ai-news/next.config.mjs
<w>  at resolve commonjs /Users/mxstbr/projects/rauchg/next-ai-news/next.config.mjs
^C

Reproduction: Run this PR to next-ai-news locally and run next dev

Versions

  • TypeScript Version: ^5
  • Fuse version: 0.12.1

mxstbr avatar Feb 14 '24 19:02 mxstbr

Odd, looks like it tries to follow the codegen import and that results in that issue. Will checkout the codegen issues to get some context

JoviDeCroock avatar Feb 14 '24 19:02 JoviDeCroock