Cannot find type definition file for 'webpack-env'

See original GitHub issue

Describe the bug Just importing addParameters into my story causes the build to break. It does not launch when you run yarn storybook or npm run storybook

** Error **

ERROR in .../node_modules/@storybook/angular/dist/client/preview/index.d.ts
ERROR in .../node_modules/@storybook/angular/dist/client/preview/index.d.ts(2,23):
TS2688: Cannot find type definition file for 'webpack-env'.

To Reproduce Steps to reproduce the behavior:

  1. Import addParameters into your story

Expected behavior Works…

Code snippets

import { addParameters} from '@storybook/angular';

System:

 npx -p @storybook/cli@next sb init --type angular

Additional context I had to install the @next cli, because of a different bug in Angular and Storybook.

Dev Dependencies

    "@storybook/addon-actions": "^5.2.0-beta.39",
    "@storybook/addon-backgrounds": "^5.1.11",
    "@storybook/addon-links": "^5.2.0-beta.39",
    "@storybook/addon-notes": "^5.2.0-beta.39",
    "@storybook/addons": "^5.2.0-beta.39",
    "@storybook/angular": "^5.2.0-beta.39",

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:44 (34 by maintainers)

github_iconTop GitHub Comments

3reactions
kroedercommented, Sep 5, 2019

Can confirm this.

@VladislavLobakh If you can, use skipLibCheck: true as a workaround until this is solved Please let me know if this workaround doesn’t work for you!

Edit Another workaround is installing the types for webpack-env => npm i -D @types/webpack-env

I try to figure out what’s wrong later this week

Example .storybook/tsconfig.json

{
  "extends": "../tsconfig.app.json",
  "compilerOptions": {
    "types": [
      "node"
    ],
    "skipLibCheck": true
  },
  "exclude": [
    "../src/test.ts",
    "../src/**/*.spec.ts",
    "../projects/**/*.spec.ts"
  ],
  "include": [
    "../src/**/*",
    "../projects/**/*"
  ],
  "files": [
    "./typings.d.ts"
  ]
}
2reactions
kroedercommented, Sep 17, 2019

I saw that a lot of packages added webpack env to the types property of tsconfig.json

I was able get rid of it in angular but I’m not sure why it was added in the first place.

If this is a trouble maker we can try to get rid of this again. Or add an explicit dependency on webpack-env in storybook/core

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build:Cannot find type definition file for webpack-env
Go to 'Dependencies' -> right click on 'npm' and click 'Restore Packages enter image description here.
Read more >
@types/webpack-env - npm
TypeScript definitions for webpack (module API). ... Start using @types/webpack-env in your project by running `npm i @types/webpack-env`.
Read more >
TS2688: Cannot find type definition file for 'webpack'.
I created a new SPA application using React following the instructions at ...
Read more >
Cannot find type definition file for 'node' in TypeScript
To solve the error "Cannot find type definition file for node", install the node types by running npm i -D @types/node . If...
Read more >
Error TS2688: Cannot find type definition file for 'node'
If am receiving this error when running the vtex link command: Webpack for react@3.x builder finished in 464ms with errors: [at-loader] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found