umijs / umi

A framework in react community ✨
https://umijs.org
MIT License
15.39k stars 2.65k forks source link

Failed to compile: @types/lodash was not found in dll umi #2048

Closed fairymeee closed 5 years ago

fairymeee commented 5 years ago

My steps:

1. yarn install (succeeded)
2. yarn start (Failed to compile, @types/lodash was not found in dll umi)
3. yarn add @types/lodash (succeeded)
4. yarn start (Failed to compile, @types/lodash was not found in dll umi)

Failed to compile: image

imhele commented 5 years ago

yarn add @types/lodash --dev

不加 --dev 会让 @types/ 包走 dll ,@types/ 包里面一般只有 .d.ts 没有 main 入口。

fairymeee commented 5 years ago

Solved! Edit config/config.js, Add '@types/lodash' to exclude.

            ...
            dll: {
              include: ['dva', 'dva/router', 'dva/saga', 'dva/fetch'],
              exclude: ['@babel/runtime', '@types/lodash'],
            },
            hardSource: true,
           ...