Skip to content

Cannot read property 'tap' of undefined #942

@VincentLanglet

Description

@VincentLanglet

I'm using the following library:

  • react-pdf
  • storybook
  • webpack-encore

I recently tried to upgrade webpack-encore to version 1.0, with the wepack 5 support.

But some of my dependencies are still using webpack 4 (like storybook storybookjs/storybook#14012 (comment)), so I have 2 webpack versions in my node_modules.

If I use

"resolutions": {
    "webpack": "^5.23.0"
},

My build works fine ; except the fact that storybook doesn't work (cf issue).

But if I don't use it, I get

 error  in ./node_modules/react-pdf/dist/esm/pdf.worker.entry.js

Syntax Error: TypeError: Cannot read property 'tap' of undefined

This is because I'm following https://github.com/wojtekmaj/react-pdf#enable-pdfjs-worker, with the code

Encore.addAliases({
    'react-pdf': path.resolve(__dirname, 'node_modules/react-pdf/dist/esm/entry.webpack'),
});

This code was working fine with webpack 4, and is working too if I use resolution.

Why it wouldn't work without the resolution. Would it be possible that webpack-encore is messing up with the webpack version to use ? (Like the issue I got: #727)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions