Open karlhorky opened 1 year ago
It may be related to the broken types published with @crxjs/vite-plugin
, which you can see on Are the types wrong?:
Imports of "@crxjs/vite-plugin" under all modern module resolution settings resolved through a conditional package.json export, but only after failing to resolve through an earlier condition. This behavior is a TypeScript bug and should not be relied upon.
Imports of "@crxjs/vite-plugin" under the node16 module resolution setting when the importing module is ESM (its extension is .mts or .mjs, or it has a .ts or .js extension and is in scope of a package.json that contains "type": "module") resolved to CJS types, but ESM implementations.
For now, users can work around this problem by:
dist/index.mjs
file:-import { defineManifest } from '@crxjs/vite-plugin';
+import { defineManifest } from '@crxjs/vite-plugin/dist/index.mjs';
node_modules
using pnpm patch
or patch-package
: rename node_modules/@crxjs/vite-plugin/dist/index.d.ts
to node_modules/@crxjs/vite-plugin/dist/index.d.mts
(note the m
in the .mts
extension)
Build tool
Vite
Where do you see the problem?
Describe the bug
The
eslint-plugin-import
ruleimport/no-unresolved
cannot resolve the@crxjs/vite-plugin
import withinmanifest.config.ts
mentioned in the docs:Reproduction
StackBlitz Demo (run
pnpm eslint manifest.config.ts
): https://stackblitz.com/edit/node-vqr1sb?file=manifest.config.ts&file=.eslintrc.cjsReproduce with:
Edit
tsconfig.node.json
: add"manifest.config.ts"
and".eslintrc.cjs"
to the"include"
arrayThen add two files:
manifest.config.ts
, based off the docs:.eslintrc.cjs
Logs
No response
System Info
Severity
annoyance