pmmmwh / react-refresh-webpack-plugin

A Webpack plugin to enable "Fast Refresh" (also previously known as Hot Reloading) for React components.
MIT License
3.15k stars 193 forks source link

TypeError: Cannot read properties of undefined (reading 'tapPromise') #740

Closed lsbyerley closed 1 year ago

lsbyerley commented 1 year ago

After upgrading to babel-loader v9, an error is generated from this plugin when running storybook. Has anyone encountered this before?

ERR! TypeError: Cannot read properties of undefined (reading 'tapPromise')
ERR!     at /app/node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/index.js:104:35
ERR!     at Array.forEach (<anonymous>)
ERR!     at ReactRefreshPlugin.apply (/app/node_modules/@pmmmwh/react-refresh-webpack-plugin/lib/index.js:103:33)
ERR!     at webpack (/app/node_modules/@storybook/builder-webpack4/node_modules/webpack/lib/webpack.js:51:13)
ERR!     at starterGeneratorFn (/app/node_modules/@storybook/builder-webpack4/dist/cjs/index.js:137:18)
ERR!     at starterGeneratorFn.next (<anonymous>)
ERR!     at Object.start (/app/node_modules/@storybook/builder-webpack4/dist/cjs/index.js:275:34)
ERR!     at async Promise.all (index 0)
ERR!     at async storybookDevServer (/app/node_modules/@storybook/core-server/dist/cjs/dev-server.js:203:28)
ERR!     at async buildDevStandalone (/app/node_modules/@storybook/core-server/dist/cjs/build-dev.js:120:31)
"babel-loader": "9.1.2",
"@storybook/addon-essentials": "6.5.16",
"@storybook/core": "6.5.16",
"@storybook/react": "6.5.16",
pmmmwh commented 1 year ago

I believe you might have two versions of tapable installed. Can you print your dependency graph or check node_modules?

lsbyerley commented 1 year ago

@pmmmwh looks like 1.1.3 and 2.2.1 ?

➜  npm list tapable
├─┬ @storybook/addon-essentials@6.5.16
│ └─┬ @storybook/core-common@6.5.16
│   ├─┬ fork-ts-checker-webpack-plugin@6.5.3
│   │ └── tapable@1.1.3
│   └─┬ webpack@4.46.0
│     ├─┬ enhanced-resolve@4.5.0
│     │ └── tapable@1.1.3 deduped
│     └── tapable@1.1.3 deduped
└─┬ @storybook/core@6.5.16
  ├─┬ @storybook/core-server@6.5.16
  │ ├─┬ @storybook/builder-webpack4@6.5.16
  │ │ ├─┬ fork-ts-checker-webpack-plugin@4.1.6
  │ │ │ └── tapable@1.1.3 deduped
  │ │ ├─┬ html-webpack-plugin@4.5.2
  │ │ │ └── tapable@1.1.3 deduped
  │ │ └─┬ webpack@4.46.0
  │ │   ├─┬ enhanced-resolve@4.5.0
  │ │   │ └── tapable@1.1.3 deduped
  │ │   └── tapable@1.1.3 deduped
  │ ├─┬ @storybook/manager-webpack4@6.5.16
  │ │ └─┬ webpack@4.46.0
  │ │   ├─┬ enhanced-resolve@4.5.0
  │ │   │ └── tapable@1.1.3 deduped
  │ │   └── tapable@1.1.3 deduped
  │ └─┬ webpack@4.46.0
  │   ├─┬ enhanced-resolve@4.5.0
  │   │ └── tapable@1.1.3 deduped
  │   └── tapable@1.1.3 deduped
  └─┬ webpack@5.79.0
    ├─┬ enhanced-resolve@5.12.0
    │ └── tapable@2.2.1
    └── tapable@2.2.1
lsbyerley commented 1 year ago

upgrading to storybook v7 solved the issue