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

Add support for multiple webpack chunks in iframe #1083

Merged
merged 6 commits into from
Jun 7, 2017

Conversation

ndelangen
Copy link
Member

This is a replacement PR for #677

This allows an arbitrary number of files to be loaded into the iframe,
not just the single preview.bundle.js file.

Webpack plugins can output chunks in a separate file. In dev, since
file names are predictable, I can add the js file into a head.html file.
When building storybook statically, however, js files have a hash added
to them, so this doesn't work.

This change makes the static build parse all webpack chunks and load
them in the iframe (excluding the manager script), instead of only
including known files.

This allows an arbitrary number of files to be loaded into the iframe,
not just the single `preview.bundle.js` file.

Webpack plugins can output chunks in a separate file. In dev, since
file names are predictable, I can add the js file into a head.html file.
When building storybook statically, however, js files have a hash added
to them, so this doesn't work.

This change makes the static build parse all webpack chunks and load
them in the iframe (excluding the manager script), instead of only
including known files.
@ndelangen
Copy link
Member Author

@apexskier Can you please review and test?

@codecov
Copy link

codecov bot commented Jun 6, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@bce5716). Click here to learn what that means.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1083   +/-   ##
=========================================
  Coverage          ?   13.64%           
=========================================
  Files             ?      207           
  Lines             ?     4640           
  Branches          ?      517           
=========================================
  Hits              ?      633           
  Misses            ?     3555           
  Partials          ?      452
Impacted Files Coverage Δ
app/react/src/server/config/webpack.config.js 0% <ø> (ø)
app/react/src/server/middleware.js 0% <0%> (ø)
app/react/src/server/iframe.html.js 0% <0%> (ø)
app/react/src/server/index.js 0% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bce5716...207eb44. Read the comment docs.

@ndelangen ndelangen self-assigned this Jun 7, 2017
@ndelangen
Copy link
Member Author

  • I've extended the original PR to also work for devmode.
  • The message "storybook started" has been moved till after webpack has compiled.
  • I've added a progress indicator whilst webpack is busy.

Can someone please review?

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

Successfully merging this pull request may close these issues.

4 participants