TL;DR
I'm using Vite. My build complains Cannot find webpack. It seems strange that I need webpack types.
Background / context
I'm using unplugin-icons in a Vite / Vue 3 / TypeScript project. This is my build script:
"build": "vue-tsc --project tsconfig.build.json --noEmit && vite build",
I'm trying to migrate to pnpm; now the build fails (I assume because pnpm disallows coincidental resolution of @types/webpack from another dep):
../../node_modules/.pnpm/unplugin@0.2.19_vite@2.6.13/node_modules/unplugin/dist/index.d.ts:3:49 - error TS2307: Cannot find module 'webpack' or its corresponding type declarations.
3 import { Compiler, WebpackPluginInstance } from 'webpack';
~~~~~~~~~
../../node_modules/.pnpm/unplugin@0.2.19_vite@2.6.13/node_modules/unplugin/dist/index.d.ts:4:45 - error TS2307: Cannot find module 'webpack' or its corresponding type declarations.
4 export { Compiler as WebpackCompiler } from 'webpack';
~~~~~~~~~
../../node_modules/.pnpm/webpack-virtual-modules@0.4.3/node_modules/webpack-virtual-modules/lib/index.d.ts:1:31 - error TS2307: Cannot find module 'webpack' or its corresponding type declarations.
1 import type { Compiler } from 'webpack';
~~~~~~~~~
Solutions?
I can see that I have unplugin@0.2.19_vite@2.6.13 (Vite-specific) in my node_modules/.pnpm directory. But inside that is a plain copy of unplugin which exports index.d.ts pointing at webpack. Which of these is the intended solution?
- I should
pnpm -D @types/webpack
- I should add
--skipLibCheck to my build script
- Something else
TL;DR
I'm using Vite. My build complains
Cannot find webpack. It seems strange that I need webpack types.Background / context
I'm using
unplugin-iconsin a Vite / Vue 3 / TypeScript project. This is my build script:I'm trying to migrate to pnpm; now the build fails (I assume because pnpm disallows coincidental resolution of
@types/webpackfrom another dep):Solutions?
I can see that I have
unplugin@0.2.19_vite@2.6.13(Vite-specific) in mynode_modules/.pnpmdirectory. But inside that is a plain copy ofunpluginwhich exportsindex.d.tspointing atwebpack. Which of these is the intended solution?pnpm -D @types/webpack--skipLibCheckto mybuildscript