diff --git a/app/angular/src/server/config/defaults/webpack.config.js b/app/angular/src/server/config/defaults/webpack.config.js index 477d1c4c62b8..a4ddafb7a54a 100644 --- a/app/angular/src/server/config/defaults/webpack.config.js +++ b/app/angular/src/server/config/defaults/webpack.config.js @@ -1,73 +1,5 @@ -// import webpack from 'webpack'; -import autoprefixer from 'autoprefixer'; +import { createDefaultWebpackConfig } from '@storybook/core/server'; import { includePaths } from '../utils'; -// Add a default custom config which is similar to what React Create App does. -module.exports = storybookBaseConfig => { - const newConfig = { ...storybookBaseConfig }; - - newConfig.module.rules = [ - ...storybookBaseConfig.module.rules, - { - test: /\.css$/, - use: [ - require.resolve('style-loader'), - { - loader: require.resolve('css-loader'), - options: { - importLoaders: 1, - }, - }, - { - loader: require.resolve('postcss-loader'), - options: { - ident: 'postcss', // https://webpack.js.org/guides/migrating/#complex-options - plugins: () => [ - require('postcss-flexbugs-fixes'), // eslint-disable-line - autoprefixer({ - browsers: [ - '>1%', - 'last 4 versions', - 'Firefox ESR', - 'not ie < 9', // React doesn't support IE8 anyway - ], - flexbox: 'no-2009', - }), - ], - }, - }, - ], - }, - { - test: /\.json$/, - include: includePaths, - loader: require.resolve('json-loader'), - }, - { - test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/, - include: includePaths, - loader: require.resolve('file-loader'), - query: { - name: 'static/media/[name].[hash:8].[ext]', - }, - }, - { - test: /\.(mp4|webm|wav|mp3|m4a|aac|oga)(\?.*)?$/, - include: includePaths, - loader: require.resolve('url-loader'), - query: { - limit: 10000, - name: 'static/media/[name].[hash:8].[ext]', - }, - }, - ]; - - newConfig.resolve.alias = { - ...storybookBaseConfig.resolve.alias, - // This is to support NPM2 - 'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator'), - }; - - // Return the altered config - return newConfig; -}; +module.exports = storybookBaseConfig => + createDefaultWebpackConfig(storybookBaseConfig, includePaths); diff --git a/app/angular/src/server/config/webpack.config.js b/app/angular/src/server/config/webpack.config.js index fccf87ea32eb..1c46caa78336 100644 --- a/app/angular/src/server/config/webpack.config.js +++ b/app/angular/src/server/config/webpack.config.js @@ -2,6 +2,7 @@ import path from 'path'; import webpack from 'webpack'; import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin'; +import { managerPath } from '@storybook/core/client'; import WatchMissingNodeModulesPlugin from './WatchMissingNodeModulesPlugin'; import { includePaths, excludePaths, nodeModulesPaths, loadEnv, nodePaths } from './utils'; @@ -13,7 +14,7 @@ export default function(configDir) { const config = { devtool: 'cheap-module-source-map', entry: { - manager: [require.resolve('./polyfills'), require.resolve('../../client/manager')], + manager: [require.resolve('./polyfills'), managerPath], preview: [ require.resolve('./polyfills'), require.resolve('./globals'), diff --git a/app/angular/src/server/config/webpack.config.prod.js b/app/angular/src/server/config/webpack.config.prod.js index 4adf3deba0e4..daf288fe3c2c 100644 --- a/app/angular/src/server/config/webpack.config.prod.js +++ b/app/angular/src/server/config/webpack.config.prod.js @@ -2,6 +2,7 @@ import path from 'path'; import webpack from 'webpack'; import UglifyJsPlugin from 'uglifyjs-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin'; +import { managerPath } from '@storybook/core/client'; import babelLoaderConfig from './babel.prod'; import { includePaths, excludePaths, loadEnv, nodePaths } from './utils'; @@ -11,7 +12,7 @@ import { version } from '../../../package.json'; export default function(configDir) { const entries = { preview: [require.resolve('./polyfills'), require.resolve('./globals')], - manager: [require.resolve('./polyfills'), path.resolve(__dirname, '../../client/manager')], + manager: [require.resolve('./polyfills'), managerPath], }; const config = { diff --git a/app/polymer/src/client/index.js b/app/polymer/src/client/index.js index 4d19c3fb217f..925ffed29bb3 100644 --- a/app/polymer/src/client/index.js +++ b/app/polymer/src/client/index.js @@ -1,17 +1 @@ -// import deprecate from 'util-deprecate'; - -// NOTE export these to keep backwards compatibility -// import { action as deprecatedAction } from '@storybook/addon-actions'; -// import { linkTo as deprecatedLinkTo } from '@storybook/addon-links'; - export { storiesOf, setAddon, addDecorator, configure, getStorybook } from './preview'; - -// export const action = deprecate( -// deprecatedAction, -// '@storybook/react action is deprecated. See: https://github.com/storybooks/storybook/tree/master/addons/actions' -// ); - -// export const linkTo = deprecate( -// deprecatedLinkTo, -// '@storybook/react linkTo is deprecated. See: https://github.com/storybooks/storybook/tree/master/addons/links' -// ); diff --git a/app/polymer/src/client/manager/index.js b/app/polymer/src/client/manager/index.js deleted file mode 100644 index 24082de7ca54..000000000000 --- a/app/polymer/src/client/manager/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/* global document */ - -import renderStorybookUI from '@storybook/ui'; -import Provider from './provider'; - -const rootEl = document.getElementById('root'); -renderStorybookUI(rootEl, new Provider()); diff --git a/app/polymer/src/client/manager/preview.js b/app/polymer/src/client/manager/preview.js deleted file mode 100644 index 4f8e792d9641..000000000000 --- a/app/polymer/src/client/manager/preview.js +++ /dev/null @@ -1,39 +0,0 @@ -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; - -const iframeStyle = { - width: '100%', - height: '100%', - border: 0, - margin: 0, - padding: 0, -}; - -class Preview extends Component { - shouldComponentUpdate() { - // When the manager is re-rendered, due to changes in the layout (going full screen / changing - // addon panel to right) Preview section will update. If its re-rendered the whole html page - // inside the html is re-rendered making the story to re-mount. - // We dont have to re-render this component for any reason since changes are communicated to - // story using the channel and necessary changes are done by it. - return false; - } - - render() { - return ( -