diff --git a/examples/standalone-preview/package.json b/examples/standalone-preview/package.json index bb1eeebbb2a0..cefc27e703e9 100644 --- a/examples/standalone-preview/package.json +++ b/examples/standalone-preview/package.json @@ -6,7 +6,7 @@ "storybook": "parcel ./storybook.html --port 1337" }, "devDependencies": { - "@storybook/react": "5.1.0-alpha.32", + "@storybook/react": "5.2.0-beta.18", "parcel": "^1.12.3", "react": "^16.8.4", "react-dom": "^16.8.4" diff --git a/lib/core/src/server/manager/manager-webpack.config.js b/lib/core/src/server/manager/manager-webpack.config.js index 8884951613bb..69897a77b5e7 100644 --- a/lib/core/src/server/manager/manager-webpack.config.js +++ b/lib/core/src/server/manager/manager-webpack.config.js @@ -63,6 +63,10 @@ export default ({ options, version, dlls: dll ? ['./sb_dll/storybook_ui_dll.js'] : [], + globals: { + DOCS_MODE: docsMode, // global docs mode + PREVIEW_URL: previewUrl, // global preview URL + }, headHtmlSnippet: getManagerHeadHtml(configDir, process.env), }), template: require.resolve(`../templates/index.ejs`), @@ -73,8 +77,6 @@ export default ({ new DefinePlugin({ 'process.env': stringified, NODE_ENV: JSON.stringify(process.env.NODE_ENV), - DOCS_MODE: JSON.stringify(docsMode), // global docs mode - PREVIEW_URL: JSON.stringify(previewUrl), // global preview URL }), // See https://github.com/graphql/graphql-language-service/issues/111#issuecomment-306723400 new ContextReplacementPlugin(/graphql-language-service-interface[/\\]dist/, /\.js$/), diff --git a/lib/core/src/server/preview/iframe-webpack.config.js b/lib/core/src/server/preview/iframe-webpack.config.js index 13430b8f177b..0ee95e4481a4 100644 --- a/lib/core/src/server/preview/iframe-webpack.config.js +++ b/lib/core/src/server/preview/iframe-webpack.config.js @@ -54,6 +54,7 @@ export default ({ files, options, version: packageJson.version, + globals: {}, headHtmlSnippet: getPreviewHeadHtml(configDir, process.env), dlls: [], bodyHtmlSnippet: getPreviewBodyHtml(), diff --git a/lib/core/src/server/templates/index.ejs b/lib/core/src/server/templates/index.ejs index 5731c9b020b8..d5d2b8f21ef6 100644 --- a/lib/core/src/server/templates/index.ejs +++ b/lib/core/src/server/templates/index.ejs @@ -16,21 +16,25 @@ <% }); %>
- <% if (typeof bodyHtmlSnippet !== 'undefined') { %> <%= bodyHtmlSnippet %> <% } %> + <% if (typeof bodyHtmlSnippet !== 'undefined') { %> + <%= bodyHtmlSnippet %> + <% } %> - <% if (options.window) { %> - - <% } %> <% dlls.forEach(file => { %> - - <% }); %> <% files.js.forEach(file => { %> - + <% if (typeof globals !== 'undefined' && Object.keys(globals).length) { %> + + <% } %> + + <% dlls.forEach(file => { %> + + <% }); %> + + <% files.js.forEach(file => { %> + <% }); %>