storybookjs/storybook

Module build failed with thread-loader for javascript modules

lozinsky opened this issue · 10 comments

Describe the bug
When javascript modules build with thread-loader, building fails with the error:

ERROR in ./.storybook/generated-entry.js
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
ENOENT: no such file or directory, open '/storybook-webpack-config-with-thread-loader/.storybook/generated-entry.js'
    at PoolWorker.fromErrorObj (/storybook-webpack-config-with-thread-loader/node_modules/thread-loader/dist/WorkerPool.js:262:12)
    at /storybook-webpack-config-with-thread-loader/node_modules/thread-loader/dist/WorkerPool.js:204:29
    at mapSeries (/storybook-webpack-config-with-thread-loader/node_modules/neo-async/async.js:3625:14)
    at PoolWorker.onWorkerMessage (/storybook-webpack-config-with-thread-loader/node_modules/thread-loader/dist/WorkerPool.js:170:35)
    at /storybook-webpack-config-with-thread-loader/node_modules/thread-loader/dist/WorkerPool.js:152:14
    at Socket.onChunk (/storybook-webpack-config-with-thread-loader/node_modules/thread-loader/dist/readBuffer.js:36:9)
    at Socket.emit (events.js:321:20)
    at Socket.Readable.read (_stream_readable.js:527:10)
    at Socket.read (net.js:618:39)
    at flow (_stream_readable.js:998:34)
    at emitReadable_ (_stream_readable.js:591:3)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)
 @ multi ./node_modules/@storybook/core/dist/server/common/polyfills.js ./node_modules/@storybook/core/dist/server/preview/globals.js ./.storybook/generated-entry.js (webpack)-hot-middleware/client.js?reload=true&quiet=true main[2]

To Reproduce
Steps to reproduce the behavior:

  1. Add thread-loader@2.1.3 dependency
  2. Add thread-loader to javascript webpack rule
  3. Run start-storybook

Expected behavior
There should be no error.

Code snippets
https://github.com/lozinsky/storybook-webpack-with-thread-loader

Additional context
I guess that webpack-virtual-modules plugin

? new VirtualModulePlugin({
[path.resolve(path.join(configDir, `generated-entry.js`))]: `
import { configure } from '@storybook/${framework}';
module._StorybookPreserveDecorators = true;
configure([${stories.map(toRequireContextString).join(',')}
], module);
`,
})

is not compatible with thread-loader.

stale commented

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Having same issue, any updates? @lozinsky

stale commented

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Hi, I am having the same issue. Any update or maybe workaround? @lozinsky @chloeleichen

@hasable we stopped using thread-loader for javascript code in storybook config ☹️

stale commented

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

stale commented

Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook!

Still seeing this issue running Storybook@latest, webpack@latest, and thread-loader@latest

Same for @nuxtjs/storybook!