Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@types/loader-utils conflicts with webpack's built-in types #179

Closed
duanlikang opened this issue Mar 23, 2021 · 3 comments
Closed

@types/loader-utils conflicts with webpack's built-in types #179

duanlikang opened this issue Mar 23, 2021 · 3 comments

Comments

@duanlikang
Copy link

Hello,I am not sure if i can give feedback here.

Background Information

When I develop a plugin that uses loader-utils,and the project is base typescript.
The Dependencies:

  "dependencies": {
    "loader-utils": "^2.0.0"
  },
  "devDependencies": {
    "@types/loader-utils": "^2.0.1",
    "webpack": "^5.27.2"
  },

Question

I have some error when I build the project.

node_modules/@types/loader-utils/index.d.ts:11:10 - error TS2305: Module '"../../webpack/types"' has no exported member 'loader'.

11 import { loader } from 'webpack';
            ~~~~~~

node_modules/@types/webpack/index.d.ts:32:3 - error TS2305: Module '"../../tapable/tapable"' has no exported member 'Tapable'.

32   Tapable,
     ~~~~~~~

node_modules/@types/webpack/index.d.ts:1062:23 - error TS2707: Generic type 'SyncWaterfallHook<T, AdditionalOptions>' requires between 1 and 2 type arguments.

1062             resolver: SyncWaterfallHook;

Possible Reason

I find the @types/loader-utils depends @types/webpack.It conflicts with webpack's built-in types.Now, i have to add skipLibCheck:true in my tsconfig.json.I want to know what is the correct way to use that.

@alexander-akait
Copy link
Member

loader-utils is deprecated you should not use it, in near future we migrate all loaders and plugins from this and write notes how to migration, don't use it and use webpack types

@duanlikang
Copy link
Author

Thanks for your reply. I got it.
Look forward the future.

@NullVoxPopuli
Copy link

NullVoxPopuli commented May 3, 2021

putting this in package.json is a good enough work around for me:

    "postinstall": "rm -rf node_modules/@types/loader-utils"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants