-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Core separate manager from preview #4590
Conversation
…from-preview # Conflicts: # lib/core/src/server/build-dev.js
…etch, this would be nice.
# Conflicts: # lib/core/package.json # lib/core/server.js # lib/core/src/server/build-dev.js # lib/core/src/server/config/webpack.config.iframe.dev.js # lib/core/src/server/middleware.js # yarn.lock
# Conflicts: # addons/storyshots/storyshots-core/package.json # lib/core/package.json
…-from-preview # Conflicts: # lib/core/src/server/config/webpack.config.dev.js # lib/core/src/server/config/webpack.config.prod.js
…-from-preview # Conflicts: # addons/ondevice-knobs/package.json # addons/storyshots/storyshots-puppeteer/package.json # lib/cli/test/fixtures/react_babel_config_js/package.json # lib/cli/test/fixtures/react_babel_custom_preset/package.json # lib/cli/test/fixtures/react_babel_pkg_json/package.json # lib/cli/test/fixtures/react_babelrc/package.json # lib/cli/test/fixtures/react_babelrc_js/package.json # lib/core/package.json # yarn.lock
…-from-preview # Conflicts: # lib/core/package.json
6b0a885
to
8c5be8f
Compare
8c5be8f
to
31e46a3
Compare
@@ -0,0 +1,46 @@ | |||
module.exports = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not it be babel.config.js ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got this from here:
https://babeljs.io/docs/en/config-files
Seems to work..
@norbert the issue is that (on the build machine at least) the index for the cra-kitchen-sink app doesn't include any JS. It looks like a template? Here's the file, cached by our tunnel: https://stmeqlknrx.tunnel.chromaticqa.com/cra-kitchen-sink/index.html Here's the contents: <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!--
Notice the use of %PUBLIC_URL% in the tag above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start`.
To create a production bundle, use `npm run build`.
-->
</body>
</html> Are you sure storybook-build is working properly for the apps on the branch? Perhaps you have artifacts left on your machine from other branches? |
When I build storybook in the cra example, this is the html of the index: <!doctype html><html><head><meta charset="utf-8"><title>Storybook</title><style>html, body {
overflow: hidden;
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}</style><script>/* globals window */
/* eslint-disable no-underscore-dangle */
try {
if (window.parent !== window) {
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
window.__VUE_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__VUE_DEVTOOLS_GLOBAL_HOOK__;
}
} catch (e) {
console.warn('unable to connect to parent frame for connecting dev tools');
}</script></head><body><div id="root"></div><script src="static/runtime~manager.1be4c9c775fb85324315.bundle.js"></script><script src="static/manager.d4d9ee0e6999e2cbffca.bundle.js"></script></body></html> |
…cation of static files
.split(process.platform === 'win32' ? ';' : ':') | ||
.filter(Boolean) | ||
.map(p => path.resolve('./', p)); | ||
export const excludePaths = [nodeModulesPaths]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we revert these changes in favor of #4706 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sounds good to me. Are you able to do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure exactly what it'd be that I'd have to change here.
import HtmlWebpackHarddiskPlugin from '@ndelangen/html-webpack-harddisk-plugin'; | ||
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin'; | ||
|
||
import { version } from '../../../package.json'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should provide the version to the child process.
@ndelangen, I will revert all the NODE_PATH changes today. |
Actually I think it will be easier to just merge the #4706 before |
# Conflicts: # lib/core/src/server/config/utils.js # lib/core/src/server/config/webpack.config.dev.js # lib/core/src/server/config/webpack.config.prod.js
Should be good now |
Congratulations |
I've separated the manager from the preview webpack build.
The manager is now build in a separate child process.
this better isolates the user's code, because the webpack config is no longer shared between manager & preview.
This makes it possible for 2 versions of react to exist: 1 in preview, 1 in manager.
Or the preview react to be swapped with a react compatible lib like preact.
Also, previously conflicting webpack loaders are now possible.
We no longer need to blacklist/whitelist modules in loaders to make sure they do not double apply.
In essence: the users can now be given far more control of the webpack config.
This ties into presets.
Preset have the ability to add babel|webpack config to the preview and manager separately.