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

TypeError: The 'compilation' argument must be an instance of Compilation #72

Closed
azeez1989 opened this issue Nov 25, 2020 · 7 comments
Closed
Labels
category: bug Something isn't working

Comments

@azeez1989
Copy link

I am getting the following error when I try to configure figma with storybook- react.

ERROR in ./node_modules/storybook-addon-designs/node_modules/react-pdf/dist/pdf.worker.entry.js (./node_modules/storybook-addon-designs/node_modules/worker-loader/dist/cjs.js!./node_modules/storybook-addon-designs/node_modules/react-pdf/dist/pdf.worker.entry.js)
Module build failed (from ./node_modules/storybook-addon-designs/node_modules/worker-loader/dist/cjs.js):
TypeError: The 'compilation' argument must be an instance of Compilation

Can someone please help?

@pocka pocka added the category: bug Something isn't working label Nov 26, 2020
@pocka
Copy link
Collaborator

pocka commented Nov 26, 2020

It's hard to diagnose errors related to the worker script (react-pdf/dist/pdf.worker.entry.js)...

An error with the same message has reported on html-webpack-plugin and that might help you. If your lockfile has multiple webpack versions, it might be the root cause.

I'll release storybook-addon-designs@6.0.0-alpha, which drops react-pdf from our dependencies, until the end of this year (Sorry, I'm a bit busy now...)

@dunklesToast
Copy link

Had the same issue and the problem were mulitple Webpack Versions (4.x and 5x). You should check that via yarn why webpack and should just use one version (probably 4.44.2) or so

@kiily
Copy link

kiily commented Dec 15, 2020

Hi, I just tried installing the addon and following the setup for the new storybook (6+) syntax. Everything seems to build fine but I do not see a design tab in my stories. Tried added params globally and to specific stories and did the same with the decorator.

I have no log either of any sort of error which is not helpful. @pocka how could I setup the repo and try to debug on my side?

@pocka pocka changed the title unable to add figma to story book TypeError: The 'compilation' argument must be an instance of Compilation Dec 16, 2020
@pocka
Copy link
Collaborator

pocka commented Dec 16, 2020

@kiily
This issue is for a webpack config bug (probably) caused by the combination of multiple webpack installations and worker-loader. (I edited the title)

I believe this could help: #43

@kiily
Copy link

kiily commented Dec 16, 2020

Strange, for me what fixed it was reverting to the old syntax in main.js. Passing the following string 'storybook-addon-designs/register' immediately resulted in a working story

@xxc12138
Copy link

xxc12138 commented Dec 24, 2020

I also have this problem,but it is happen when I use VueLoaderPlugin,but it is necessary for me to use VueLoaderPlugin in my project;
plugins: [
new VueLoaderPlugin(),
]
Does anyone have this problem?I would appreciate your help

pocka added a commit that referenced this issue Dec 26, 2020
We used `react-pdf`, which internally uses `pdf-js`. The problem is,
the worker-loader triggered by `react-pdf` causes errors such as
#72 .
Of course, that error is by user misconfiguration but it's hard to
manage such kind of errors just for the minor feature.

In addition to that, I don't want to ship with a lot of dependencies
just for preview-ing. Storybook bundle tends to be big and we addon
authors should try to minimize bundle size as much as possible.

If you want the PDF preview support, please use storybook-addon-designs@v5.

BREAKING CHANGE: parameters with `pdf` type no longer works
@pocka
Copy link
Collaborator

pocka commented Dec 26, 2020

If you face this error, please make sure you don't include multiple webpack versions in your project.

FYI, I published storybook-addon-designs@v6.0.0-alpha.0 that drops the PDF preview feature.

@pocka pocka closed this as completed Dec 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants