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

@storybook/vue standalone.js fails while start-storybook succeeds #9964

Closed
vvanpo opened this issue Feb 26, 2020 · 2 comments
Closed

@storybook/vue standalone.js fails while start-storybook succeeds #9964

vvanpo opened this issue Feb 26, 2020 · 2 comments

Comments

@vvanpo
Copy link
Contributor

vvanpo commented Feb 26, 2020

Describe the bug

$ build/bin/storybook
info => Loading presets
info => Loading presets
info => Loading config/preview file in "build/storybook".
info => Adding stories defined in "build/storybook/main.js".
info => Using default Webpack setup.
70% building 249/256 modules 7 active .../node_modules/core-js/internals/a-possible-prototype.js✖ 「wdm」: Error: No module factory available for dependency type: CssDependency
    at addDependency (.../node_modules/webpack/lib/Compilation.js:800:12)
    at iterationOfArrayCallback (.../node_modules/webpack/lib/Compilation.js:208:3)
    at addDependenciesBlock (.../node_modules/webpack/lib/Compilation.js:816:5)
    at Compilation.processModuleDependencies (.../node_modules/webpack/lib/Compilation.js:827:4)
    at afterBuild (.../node_modules/webpack/lib/Compilation.js:954:15)
    at buildModule.err (.../node_modules/webpack/lib/Compilation.js:998:11)
    at callback (.../node_modules/webpack/lib/Compilation.js:734:5)
    at module.build.error (.../node_modules/webpack/lib/Compilation.js:782:12)
    at handleParseResult (.../node_modules/webpack/lib/NormalModule.js:478:12)
    at doBuild.err (.../node_modules/webpack/lib/NormalModule.js:500:6)
    at runLoaders (.../node_modules/webpack/lib/NormalModule.js:358:12)
    at .../node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (.../node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at .../node_modules/loader-runner/lib/LoaderRunner.js:186:6
    at context.callback (.../node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at childCompiler.runAsChild (.../node_modules/mini-css-extract-plugin/dist/loader.js:199:12)
.../node_modules/neo-async/async.js:16
    throw new Error('Callback was already called.');
    ^

Error: Callback was already called.
    at throwError (.../node_modules/neo-async/async.js:16:11)
    at .../node_modules/neo-async/async.js:2818:7
    at process._tickCallback (internal/process/next_tick.js:61:11)
error Command failed with exit code 1.

I've elided the absolute paths above to make it easier to read and to not expose the specifics of my environment.

To Reproduce
My script looks as follow:

#!/usr/bin/env node

require('@storybook/vue/standalone')({
  configDir: 'build/storybook',
  mode: 'dev',
  port: 6006,
})

Running this gives me the error you see above. However, running start-storybook directly with the same options succeeds:

$ node node_modules/.bin/start-storybook -c build/storybook -p 6006

Expected behavior
@storybook/vue/standalone should work identically to the supplied start-storybook executable.

System:

$ npx -p @storybook/cli@next sb info

Environment Info:

  System:
    OS: macOS 10.15.3
    CPU: (8) x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  Binaries:
    Node: 10.18.1 - /usr/local/bin/node
    Yarn: 1.22.0 - /usr/local/bin/yarn
    npm: 6.13.4 - /usr/local/bin/npm
  Browsers:
    Chrome: 79.0.3945.130
    Firefox: 72.0.2
    Safari: 13.0.5
  npmPackages:
    @storybook/vue: ^5.3.13 => 5.3.14 
@vvanpo
Copy link
Contributor Author

vvanpo commented Feb 26, 2020

Here is a work-around:

#!/usr/bin/env node

const { buildDev } = require('@storybook/core/server')
const options = require('@storybook/vue/dist/server/options').default;

buildDev({
  ...options,
  configDir: 'build/storybook',
  mode: 'dev',
  port: 6006,
})

This succeeds.

@vvanpo
Copy link
Contributor Author

vvanpo commented Feb 27, 2020

So my workaround broke with the same error even when I didn't change anything related to storybook.

But I think I figured out the problem, it had to do with NODE_ENV not being set or maybe not being set at the right time, and my webpack config not having the mini-css-extract-plugin loaded when it expects it in production mode. If I run the reproduction script or the "workaround" with NODE_ENV=development set, everything works.

So I'm not sure there is actually a bug here, this may have just been user error. I'll close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants