diff --git a/app/angular/src/server/config.js b/app/angular/src/server/config.js index 4b7958e9036b..09e5f89b35a0 100644 --- a/app/angular/src/server/config.js +++ b/app/angular/src/server/config.js @@ -2,6 +2,7 @@ import fs from 'fs'; import path from 'path'; import { logger } from '@storybook/node-logger'; +import { createDefaultWebpackConfig } from '@storybook/core/server'; import loadBabelConfig from './babel_config'; import loadTsConfig from './ts_config'; import { @@ -47,22 +48,28 @@ export default function(configType, baseConfig, configDir) { logger.info('=> Loading angular-cli config.'); } + const defaultConfig = applyAngularCliWebpackConfig( + createDefaultWebpackConfig(config), + cliWebpackConfigOptions + ); + // Check whether user has a custom webpack config file and // return the (extended) base configuration if it's not available. const customConfigPath = path.resolve(configDir, 'webpack.config.js'); if (!fs.existsSync(customConfigPath)) { logger.info('=> Using default webpack setup based on "angular-cli".'); - const configPath = path.resolve(__dirname, './config/defaults/webpack.config.js'); - const customConfig = require(configPath); - - return applyAngularCliWebpackConfig(customConfig(config), cliWebpackConfigOptions); + return defaultConfig; } const customConfig = require(customConfigPath); if (typeof customConfig === 'function') { logger.info('=> Loading custom webpack config (full-control mode).'); - return customConfig(applyAngularCliWebpackConfig(config, cliWebpackConfigOptions), configType); + return customConfig( + applyAngularCliWebpackConfig(config, cliWebpackConfigOptions), + configType, + defaultConfig + ); } logger.info('=> Loading custom webpack config (extending mode).'); diff --git a/app/angular/src/server/config/defaults/webpack.config.js b/app/angular/src/server/config/defaults/webpack.config.js index a4ddafb7a54a..ede17ef83a41 100644 --- a/app/angular/src/server/config/defaults/webpack.config.js +++ b/app/angular/src/server/config/defaults/webpack.config.js @@ -1,5 +1,7 @@ +import deprecate from 'util-deprecate'; import { createDefaultWebpackConfig } from '@storybook/core/server'; -import { includePaths } from '../utils'; -module.exports = storybookBaseConfig => - createDefaultWebpackConfig(storybookBaseConfig, includePaths); +module.exports = deprecate( + createDefaultWebpackConfig, + "importing default webpack config generator from '@storybook/angular/dist/server/config/defaults/webpack.config.js' is deprecated. Use third argument of your exported function instead. See https://storybook.js.org/configurations/custom-webpack-config/#full-control-mode--default" +); diff --git a/app/polymer/src/server/config.js b/app/polymer/src/server/config.js index 1f5ba20ec0ca..49ff8de4a4dc 100644 --- a/app/polymer/src/server/config.js +++ b/app/polymer/src/server/config.js @@ -3,6 +3,7 @@ import fs from 'fs'; import path from 'path'; import findCacheDir from 'find-cache-dir'; import { logger } from '@storybook/node-logger'; +import { createDefaultWebpackConfig } from '@storybook/core/server'; import loadBabelConfig from './babel_config'; // `baseConfig` is a webpack configuration bundled with storybook. @@ -41,22 +42,21 @@ export default function(configType, baseConfig, configDir) { config.entry.manager.splice(1, 0, storybookDefaultAddonsPath); } + const defaultConfig = createDefaultWebpackConfig(config); + // Check whether user has a custom webpack config file and // return the (extended) base configuration if it's not available. const customConfigPath = path.resolve(configDir, 'webpack.config.js'); if (!fs.existsSync(customConfigPath)) { logger.info('=> Using default webpack setup based on "polymer-cli".'); - const configPath = path.resolve(__dirname, './config/defaults/webpack.config.js'); - const customConfig = require(configPath); - - return customConfig(config); + return defaultConfig; } const customConfig = require(customConfigPath); if (typeof customConfig === 'function') { logger.info('=> Loading custom webpack config (full-control mode).'); - return customConfig(config, configType); + return customConfig(config, configType, defaultConfig); } logger.info('=> Loading custom webpack config (extending mode).'); return { diff --git a/app/polymer/src/server/config/defaults/webpack.config.js b/app/polymer/src/server/config/defaults/webpack.config.js index a4ddafb7a54a..5fe3e880d451 100644 --- a/app/polymer/src/server/config/defaults/webpack.config.js +++ b/app/polymer/src/server/config/defaults/webpack.config.js @@ -1,5 +1,7 @@ +import deprecate from 'util-deprecate'; import { createDefaultWebpackConfig } from '@storybook/core/server'; -import { includePaths } from '../utils'; -module.exports = storybookBaseConfig => - createDefaultWebpackConfig(storybookBaseConfig, includePaths); +module.exports = deprecate( + createDefaultWebpackConfig, + "importing default webpack config generator from '@storybook/polymer/dist/server/config/defaults/webpack.config.js' is deprecated. Use third argument of your exported function instead. See https://storybook.js.org/configurations/custom-webpack-config/#full-control-mode--default" +); diff --git a/app/react-native/src/server/config.js b/app/react-native/src/server/config.js index f5abb9a0d00e..07f21fa4c71a 100644 --- a/app/react-native/src/server/config.js +++ b/app/react-native/src/server/config.js @@ -2,6 +2,7 @@ import fs from 'fs'; import path from 'path'; import JSON5 from 'json5'; import findCacheDir from 'find-cache-dir'; +import { createDefaultWebpackConfig } from '@storybook/core/server'; // avoid ESLint errors const logger = console; @@ -80,13 +81,13 @@ export default function(configType, baseConfig, projectDir, configDir) { ? path.resolve(babelConfigDir, babelConfig.extends) : path.resolve(babelConfig.extends); } - config.module.loaders[0].query = babelConfig; + config.module.rules[0].query = babelConfig; } // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables a cache directory for faster-rebuilds // `find-cache-dir` will create the cache directory under the node_modules directory. - config.module.loaders[0].query.cacheDirectory = findCacheDir({ + config.module.rules[0].query.cacheDirectory = findCacheDir({ name: 'react-storybook', }); @@ -101,19 +102,21 @@ export default function(configType, baseConfig, projectDir, configDir) { config.entry.manager.unshift(storybookDefaultAddonsPath); } + const defaultConfig = createDefaultWebpackConfig(config); + // Check whether user has a custom webpack config file and // return the (extended) base configuration if it's not available. - let customConfigPath = path.resolve(configDir, 'webpack.config.js'); + const customConfigPath = path.resolve(configDir, 'webpack.config.js'); if (!fs.existsSync(customConfigPath)) { logger.info('=> Using default webpack setup based on "Create React App".'); - customConfigPath = path.resolve(__dirname, './config/defaults/webpack.config.js'); + return defaultConfig; } const customConfig = require(customConfigPath); // eslint-disable-line if (typeof customConfig === 'function') { logger.info('=> Loading custom webpack config (full-control mode).'); - return customConfig(config, configType); + return customConfig(config, configType, defaultConfig); } logger.info('=> Loading custom webpack config.'); @@ -129,9 +132,9 @@ export default function(configType, baseConfig, projectDir, configDir) { plugins: [...config.plugins, ...(customConfig.plugins || [])], module: { ...config.module, - // We need to use our and custom loaders. + // We need to use our and custom rules. ...customConfig.module, - loaders: [...config.module.loaders, ...(customConfig.module.loaders || [])], + rules: [...config.module.rules, ...(customConfig.module.rules || [])], }, }; } diff --git a/app/react-native/src/server/config/defaults/webpack.config.js b/app/react-native/src/server/config/defaults/webpack.config.js index 97df0e98f9a7..ae3505cb7075 100644 --- a/app/react-native/src/server/config/defaults/webpack.config.js +++ b/app/react-native/src/server/config/defaults/webpack.config.js @@ -1,63 +1,7 @@ -import autoprefixer from 'autoprefixer'; -import { includePaths } from '../utils'; +import deprecate from 'util-deprecate'; +import { createDefaultWebpackConfig } from '@storybook/core/server'; -// Add a default custom config which is similar to what React Create App does. -module.exports = storybookBaseConfig => { - const newConfig = { ...storybookBaseConfig }; - - newConfig.module.loaders = [ - ...newConfig.module.loaders, - { - test: /\.css?$/, - include: includePaths, - use: [ - require.resolve('style-loader'), - require.resolve('css-loader'), - { - loader: require.resolve('postcss-loader'), - options: { - plugins: () => [ - autoprefixer({ - browsers: ['>1%', 'last 4 versions', 'Firefox ESR', 'not ie < 9'], - }), - ], - }, - }, - ], - }, - { - test: /\.json$/, - include: includePaths, - loader: require.resolve('json-loader'), - }, - { - test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/, - include: includePaths, - loader: require.resolve('file-loader'), - query: { - name: 'static/media/[name].[hash:8].[ext]', - }, - }, - { - test: /\.(mp4|webm)(\?.*)?$/, - include: includePaths, - loader: require.resolve('url-loader'), - query: { - limit: 10000, - name: 'static/media/[name].[hash:8].[ext]', - }, - }, - ]; - - newConfig.resolve = { - ...newConfig.resolve, - alias: { - ...((newConfig.resolve && newConfig.resolve.alias) || {}), - // This is to support NPM2 - 'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator'), - }, - }; - - // Return the altered config - return newConfig; -}; +module.exports = deprecate( + createDefaultWebpackConfig, + "importing default webpack config generator from '@storybook/react-native/dist/server/config/defaults/webpack.config.js' is deprecated. Use third argument of your exported function instead. See https://storybook.js.org/configurations/custom-webpack-config/#full-control-mode--default" +); diff --git a/app/react-native/src/server/config/webpack.config.js b/app/react-native/src/server/config/webpack.config.js index 44e9be40779c..f4048c4b380f 100644 --- a/app/react-native/src/server/config/webpack.config.js +++ b/app/react-native/src/server/config/webpack.config.js @@ -27,7 +27,7 @@ const getConfig = options => ({ new CaseSensitivePathsPlugin(), ], module: { - loaders: [ + rules: [ { test: /\.jsx?$/, loader: require.resolve('babel-loader'), diff --git a/app/react-native/src/server/config/webpack.config.prod.js b/app/react-native/src/server/config/webpack.config.prod.js index 3244608ac28f..629710db51b0 100644 --- a/app/react-native/src/server/config/webpack.config.prod.js +++ b/app/react-native/src/server/config/webpack.config.prod.js @@ -47,7 +47,7 @@ const getConfig = options => { }), ], module: { - loaders: [ + rules: [ { test: /\.jsx?$/, loader: require.resolve('babel-loader'), diff --git a/app/react/src/server/config.js b/app/react/src/server/config.js index 2e4fb8f77205..dfe7c66ed059 100644 --- a/app/react/src/server/config.js +++ b/app/react/src/server/config.js @@ -3,6 +3,7 @@ import fs from 'fs'; import path from 'path'; import findCacheDir from 'find-cache-dir'; import { logger } from '@storybook/node-logger'; +import { createDefaultWebpackConfig } from '@storybook/core/server'; import loadBabelConfig from './babel_config'; // `baseConfig` is a webpack configuration bundled with storybook. @@ -41,22 +42,21 @@ export default function(configType, baseConfig, configDir) { config.entry.manager.splice(1, 0, storybookDefaultAddonsPath); } + const defaultConfig = createDefaultWebpackConfig(config); + // Check whether user has a custom webpack config file and // return the (extended) base configuration if it's not available. const customConfigPath = path.resolve(configDir, 'webpack.config.js'); if (!fs.existsSync(customConfigPath)) { logger.info('=> Using default webpack setup based on "Create React App".'); - const configPath = path.resolve(__dirname, './config/defaults/webpack.config.js'); - const customConfig = require(configPath); - - return customConfig(config); + return defaultConfig; } const customConfig = require(customConfigPath); if (typeof customConfig === 'function') { logger.info('=> Loading custom webpack config (full-control mode).'); - return customConfig(config, configType); + return customConfig(config, configType, defaultConfig); } logger.info('=> Loading custom webpack config (extending mode).'); return { diff --git a/app/react/src/server/config/defaults/webpack.config.js b/app/react/src/server/config/defaults/webpack.config.js index a4ddafb7a54a..0c27cf2bc44a 100644 --- a/app/react/src/server/config/defaults/webpack.config.js +++ b/app/react/src/server/config/defaults/webpack.config.js @@ -1,5 +1,7 @@ +import deprecate from 'util-deprecate'; import { createDefaultWebpackConfig } from '@storybook/core/server'; -import { includePaths } from '../utils'; -module.exports = storybookBaseConfig => - createDefaultWebpackConfig(storybookBaseConfig, includePaths); +module.exports = deprecate( + createDefaultWebpackConfig, + "importing default webpack config generator from '@storybook/react/dist/server/config/defaults/webpack.config.js' is deprecated. Use third argument of your exported function instead. See https://storybook.js.org/configurations/custom-webpack-config/#full-control-mode--default" +); diff --git a/app/vue/src/server/config.js b/app/vue/src/server/config.js index 9b8c07558911..1ef00345b3cb 100644 --- a/app/vue/src/server/config.js +++ b/app/vue/src/server/config.js @@ -2,6 +2,7 @@ import fs from 'fs'; import path from 'path'; import findCacheDir from 'find-cache-dir'; +import { createDefaultWebpackConfig } from '@storybook/core/server'; import loadBabelConfig from './babel_config'; // avoid ESLint errors @@ -43,22 +44,21 @@ export default function(configType, baseConfig, configDir) { config.entry.manager.splice(1, 0, storybookDefaultAddonsPath); } + const defaultConfig = createDefaultWebpackConfig(config); + // Check whether user has a custom webpack config file and // return the (extended) base configuration if it's not available. const customConfigPath = path.resolve(configDir, 'webpack.config.js'); if (!fs.existsSync(customConfigPath)) { logger.info('=> Using default webpack setup based on "vue-cli".'); - const configPath = path.resolve(__dirname, './config/defaults/webpack.config.js'); - const customConfig = require(configPath); - - return customConfig(config); + return defaultConfig; } const customConfig = require(customConfigPath); if (typeof customConfig === 'function') { logger.info('=> Loading custom webpack config (full-control mode).'); - return customConfig(config, configType); + return customConfig(config, configType, defaultConfig); } logger.info('=> Loading custom webpack config (extending mode).'); return { diff --git a/app/vue/src/server/config/defaults/webpack.config.js b/app/vue/src/server/config/defaults/webpack.config.js index a4ddafb7a54a..45aa04670897 100644 --- a/app/vue/src/server/config/defaults/webpack.config.js +++ b/app/vue/src/server/config/defaults/webpack.config.js @@ -1,5 +1,7 @@ +import deprecate from 'util-deprecate'; import { createDefaultWebpackConfig } from '@storybook/core/server'; -import { includePaths } from '../utils'; -module.exports = storybookBaseConfig => - createDefaultWebpackConfig(storybookBaseConfig, includePaths); +module.exports = deprecate( + createDefaultWebpackConfig, + "importing default webpack config generator from '@storybook/vue/dist/server/config/defaults/webpack.config.js' is deprecated. Use third argument of your exported function instead. See https://storybook.js.org/configurations/custom-webpack-config/#full-control-mode--default" +); diff --git a/docs/src/pages/configurations/custom-webpack-config/index.md b/docs/src/pages/configurations/custom-webpack-config/index.md index 870a241a03a5..872735689d2c 100644 --- a/docs/src/pages/configurations/custom-webpack-config/index.md +++ b/docs/src/pages/configurations/custom-webpack-config/index.md @@ -95,28 +95,21 @@ You may want to keep Storybook's [default config](/configurations/default-config If so, this is how you do it using the Full Control Mode. Add following content to the `webpack.config.js` in your Storybook config directory. -> We plan to expose our default webpack-config as it's own package in the future. - ```js const path = require('path'); -// load the default config generator. -const genDefaultConfig = require('@storybook/react/dist/server/config/defaults/webpack.config.js'); - -module.exports = (baseConfig, env) => { - const config = genDefaultConfig(baseConfig, env); - - // Extend it as you need. +module.exports = (baseConfig, env, defaultConfig) => { + // Extend defaultConfig as you need. // For example, add typescript loader: - config.module.rules.push({ + defaultConfig.module.rules.push({ test: /\.(ts|tsx)$/, include: path.resolve(__dirname, '../src'), loader: require.resolve('ts-loader') }); - config.resolve.extensions.push('.ts', '.tsx'); + defaultConfig.resolve.extensions.push('.ts', '.tsx'); - return config; + return defaultConfig; }; ``` diff --git a/examples/cra-kitchen-sink/.storybook/webpack.config.js b/examples/cra-kitchen-sink/.storybook/webpack.config.js index 001da2406dda..5e12befd0629 100644 --- a/examples/cra-kitchen-sink/.storybook/webpack.config.js +++ b/examples/cra-kitchen-sink/.storybook/webpack.config.js @@ -1,18 +1,13 @@ const webpack = require('webpack'); -// load the default config generator. -const genDefaultConfig = require('@storybook/react/dist/server/config/defaults/webpack.config.js'); - -// Export a function. Accept the base config as the only param. -module.exports = (storybookBaseConfig, configType) => { +// Export a function. +module.exports = (storybookBaseConfig, configType, defaultConfig) => { // configType has a value of 'DEVELOPMENT' or 'PRODUCTION' // You can change the configuration based on that. // 'PRODUCTION' is used when building the static version of storybook. - const config = genDefaultConfig(storybookBaseConfig, configType); - // Make whatever fine-grained changes you need - config.plugins.push( + defaultConfig.plugins.push( new webpack.optimize.CommonsChunkPlugin({ name: "vendor", chunks: ['preview'], @@ -24,5 +19,5 @@ module.exports = (storybookBaseConfig, configType) => { ); // Return the altered config - return config; + return defaultConfig; }; diff --git a/examples/crna-kitchen-sink/storybook/webpack.config.js b/examples/crna-kitchen-sink/storybook/webpack.config.js index a2daea72816d..fc1c6ded8738 100644 --- a/examples/crna-kitchen-sink/storybook/webpack.config.js +++ b/examples/crna-kitchen-sink/storybook/webpack.config.js @@ -1,18 +1,12 @@ const webpack = require('webpack'); -// load the default config generator. -const genDefaultConfig = require('@storybook/react-native/dist/server/config/defaults/webpack.config.js'); - -// Export a function. Accept the base config as the only param. -module.exports = (storybookBaseConfig, configType) => { +module.exports = (storybookBaseConfig, configType, defaultConfig) => { // configType has a value of 'DEVELOPMENT' or 'PRODUCTION' // You can change the configuration based on that. // 'PRODUCTION' is used when building the static version of storybook. - const config = genDefaultConfig(storybookBaseConfig, configType); - // Make whatever fine-grained changes you need - config.plugins.push( + defaultConfig.plugins.push( new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', minChunks(module) { @@ -23,5 +17,5 @@ module.exports = (storybookBaseConfig, configType) => { ); // Return the altered config - return config; + return defaultConfig; }; diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-default-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-default-1-snap.png new file mode 100644 index 000000000000..c09270915869 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-default-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-delayed-render-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-delayed-render-1-snap.png new file mode 100644 index 000000000000..113fea49283c Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-delayed-render-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-disabled-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-disabled-1-snap.png new file mode 100644 index 000000000000..d0c8b648c6bf Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-disabled-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-invalid-contrast-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-invalid-contrast-1-snap.png new file mode 100644 index 000000000000..dd119821d0dc Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-invalid-contrast-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-label-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-label-1-snap.png new file mode 100644 index 000000000000..b13b8e36d6f7 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-a-11-y-label-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-all-types-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-all-types-1-snap.png new file mode 100644 index 000000000000..cf53b5ba3568 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-all-types-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-circular-payload-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-circular-payload-1-snap.png new file mode 100644 index 000000000000..0788bd2d26d6 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-circular-payload-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-decorated-action-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-decorated-action-1-snap.png new file mode 100644 index 000000000000..7fd7bd5eb99c Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-decorated-action-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-function-name-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-function-name-1-snap.png new file mode 100644 index 000000000000..381412356b44 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-function-name-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-hello-world-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-hello-world-1-snap.png new file mode 100644 index 000000000000..a029405075ae Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-hello-world-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-reserved-keyword-as-name-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-reserved-keyword-as-name-1-snap.png new file mode 100644 index 000000000000..816fede4a923 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-actions-reserved-keyword-as-name-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-backgrounds-story-1-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-backgrounds-story-1-1-snap.png new file mode 100644 index 000000000000..bb85d3e04839 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-backgrounds-story-1-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-backgrounds-story-2-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-backgrounds-story-2-1-snap.png new file mode 100644 index 000000000000..281c42737ae0 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-backgrounds-story-2-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-events-logger-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-events-logger-1-snap.png new file mode 100644 index 000000000000..59fc2e0af6e5 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-events-logger-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-decorator-use-info-as-story-decorator-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-decorator-use-info-as-story-decorator-1-snap.png new file mode 100644 index 000000000000..159c2f1198da Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-decorator-use-info-as-story-decorator-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-git-hub-issues-1814-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-git-hub-issues-1814-1-snap.png new file mode 100644 index 000000000000..e9fa19c70e42 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-git-hub-issues-1814-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-markdown-displays-markdown-in-description-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-markdown-displays-markdown-in-description-1-snap.png new file mode 100644 index 000000000000..159c2f1198da Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-markdown-displays-markdown-in-description-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-header-shows-or-hides-info-addon-header-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-header-shows-or-hides-info-addon-header-1-snap.png new file mode 100644 index 000000000000..159c2f1198da Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-header-shows-or-hides-info-addon-header-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-inline-inlines-component-inside-story-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-inline-inlines-component-inside-story-1-snap.png new file mode 100644 index 000000000000..4ef25a6089c0 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-inline-inlines-component-inside-story-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-prop-tables-exclude-exclude-component-from-prop-tables-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-prop-tables-exclude-exclude-component-from-prop-tables-1-snap.png new file mode 100644 index 000000000000..ca92299ae67e Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-prop-tables-exclude-exclude-component-from-prop-tables-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-prop-tables-shows-additional-component-prop-tables-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-prop-tables-shows-additional-component-prop-tables-1-snap.png new file mode 100644 index 000000000000..159c2f1198da Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-prop-tables-shows-additional-component-prop-tables-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-source-shows-or-hides-info-addon-source-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-source-shows-or-hides-info-addon-source-1-snap.png new file mode 100644 index 000000000000..159c2f1198da Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-source-shows-or-hides-info-addon-source-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-styles-extend-info-styles-with-an-object-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-styles-extend-info-styles-with-an-object-1-snap.png new file mode 100644 index 000000000000..f569a4f78aab Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-styles-extend-info-styles-with-an-object-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-styles-full-control-over-styles-using-a-function-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-styles-full-control-over-styles-using-a-function-1-snap.png new file mode 100644 index 000000000000..159c2f1198da Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-styles-full-control-over-styles-using-a-function-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-table-component-use-a-custom-component-for-the-table-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-table-component-use-a-custom-component-for-the-table-1-snap.png new file mode 100644 index 000000000000..159c2f1198da Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-options-table-component-use-a-custom-component-for-the-table-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-react-docgen-comments-from-component-declaration-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-react-docgen-comments-from-component-declaration-1-snap.png new file mode 100644 index 000000000000..159c2f1198da Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-react-docgen-comments-from-component-declaration-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-react-docgen-comments-from-flow-declarations-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-react-docgen-comments-from-flow-declarations-1-snap.png new file mode 100644 index 000000000000..b9786facf99d Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-react-docgen-comments-from-flow-declarations-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-react-docgen-comments-from-prop-type-declarations-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-react-docgen-comments-from-prop-type-declarations-1-snap.png new file mode 100644 index 000000000000..5f4bfb87a3f8 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-info-react-docgen-comments-from-prop-type-declarations-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-jest-with-tests-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-jest-with-tests-1-snap.png new file mode 100644 index 000000000000..9c7911927ee5 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-jest-with-tests-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-knobs-with-knobs-options-triggers-actions-via-button-with-debounce-delay-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-knobs-with-knobs-options-triggers-actions-via-button-with-debounce-delay-1-snap.png new file mode 100644 index 000000000000..6a2275ede1d0 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-knobs-with-knobs-options-triggers-actions-via-button-with-debounce-delay-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-knobs-with-knobs-options-tweaks-static-values-with-debounce-delay-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-knobs-with-knobs-options-tweaks-static-values-with-debounce-delay-1-snap.png new file mode 100644 index 000000000000..4efa9acbe78d Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-knobs-with-knobs-options-tweaks-static-values-with-debounce-delay-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-knobs-with-knobs-triggers-actions-via-button-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-knobs-with-knobs-triggers-actions-via-button-1-snap.png new file mode 100644 index 000000000000..6a2275ede1d0 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-knobs-with-knobs-triggers-actions-via-button-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-knobs-with-knobs-tweaks-static-values-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-knobs-with-knobs-tweaks-static-values-1-snap.png new file mode 100644 index 000000000000..8b12bd26aaac Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-knobs-with-knobs-tweaks-static-values-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-button-first-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-button-first-1-snap.png new file mode 100644 index 000000000000..ff733cc46576 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-button-first-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-button-second-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-button-second-1-snap.png new file mode 100644 index 000000000000..5ac41e52149d Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-button-second-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-href-log-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-href-log-1-snap.png new file mode 100644 index 000000000000..b573ee11c632 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-href-log-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-link-first-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-link-first-1-snap.png new file mode 100644 index 000000000000..fafe2c4d3311 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-link-first-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-link-second-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-link-second-1-snap.png new file mode 100644 index 000000000000..bc8aaf0c2508 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-link-second-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-select-first-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-select-first-1-snap.png new file mode 100644 index 000000000000..11c73895718b Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-select-first-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-select-index-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-select-index-1-snap.png new file mode 100644 index 000000000000..3bc7236fc353 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-select-index-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-select-second-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-select-second-1-snap.png new file mode 100644 index 000000000000..11c73895718b Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-select-second-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-select-third-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-select-third-1-snap.png new file mode 100644 index 000000000000..11c73895718b Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-links-select-third-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-notes-using-deprecated-api-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-notes-using-deprecated-api-1-snap.png new file mode 100644 index 000000000000..c0ac1100d5bc Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-notes-using-deprecated-api-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-notes-with-notes-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-notes-with-notes-1-snap.png new file mode 100644 index 000000000000..d2bd2cf34404 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-notes-with-notes-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-notes-with-notes-rendering-imported-markdown-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-notes-with-notes-rendering-imported-markdown-1-snap.png new file mode 100644 index 000000000000..d2bd2cf34404 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-addons-notes-with-notes-rendering-imported-markdown-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-ui-stories-stories-panel-stories-hierarchies-exists-but-is-empty-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-ui-stories-stories-panel-stories-hierarchies-exists-but-is-empty-1-snap.png new file mode 100644 index 000000000000..5f8e36621a41 Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-ui-stories-stories-panel-stories-hierarchies-exists-but-is-empty-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-ui-stories-stories-panel-with-stories-hierarchies-prop-1-snap.png b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-ui-stories-stories-panel-with-stories-hierarchies-prop-1-snap.png new file mode 100644 index 000000000000..666652032e2c Binary files /dev/null and b/examples/official-storybook/image-snapshots/__image_snapshots__/storyshots-image-runner-js-image-snapshots-ui-stories-stories-panel-with-stories-hierarchies-prop-1-snap.png differ diff --git a/examples/official-storybook/image-snapshots/storyshots-image.runner.js b/examples/official-storybook/image-snapshots/storyshots-image.runner.js index 6fd4a399d958..19e82c2a50f2 100644 --- a/examples/official-storybook/image-snapshots/storyshots-image.runner.js +++ b/examples/official-storybook/image-snapshots/storyshots-image.runner.js @@ -20,10 +20,11 @@ if (!fs.existsSync(pathToStorybookStatic)) { suite: 'Image snapshots', framework: 'react', configPath: path.join(__dirname, '..'), + storyNameRegex: /^((?!tweaks static values with debounce delay|Inlines component inside story).)$/, test: imageSnapshot({ storybookUrl: `file://${pathToStorybookStatic}`, getMatchOptions: () => ({ - failureThreshold: 0.01, // 1% threshold, + failureThreshold: 0.04, // 4% threshold, failureThresholdType: 'percent', }), }), diff --git a/examples/vue-kitchen-sink/.storybook/webpack.config.js b/examples/vue-kitchen-sink/.storybook/webpack.config.js index 416bb092edd9..c96b297ebae5 100644 --- a/examples/vue-kitchen-sink/.storybook/webpack.config.js +++ b/examples/vue-kitchen-sink/.storybook/webpack.config.js @@ -1,18 +1,12 @@ const webpack = require('webpack'); -// load the default config generator. -const genDefaultConfig = require('@storybook/vue/dist/server/config/defaults/webpack.config.js'); - -// Export a function. Accept the base config as the only param. -module.exports = (storybookBaseConfig, configType) => { +module.exports = (storybookBaseConfig, configType, defaultConfig) => { // configType has a value of 'DEVELOPMENT' or 'PRODUCTION' // You can change the configuration based on that. // 'PRODUCTION' is used when building the static version of storybook. - const config = genDefaultConfig(storybookBaseConfig, configType); - // Make whatever fine-grained changes you need - config.plugins.push( + defaultConfig.plugins.push( new webpack.optimize.CommonsChunkPlugin({ name: "vendor", chunks: ['preview'], @@ -24,5 +18,5 @@ module.exports = (storybookBaseConfig, configType) => { ); // Return the altered config - return config; + return defaultConfig; }; diff --git a/lib/core/src/server/config/defaults/webpack.config.js b/lib/core/src/server/config/defaults/webpack.config.js index 8987fef8f2e3..a83800ab86bb 100644 --- a/lib/core/src/server/config/defaults/webpack.config.js +++ b/lib/core/src/server/config/defaults/webpack.config.js @@ -1,65 +1,65 @@ import autoprefixer from 'autoprefixer'; -export function createDefaultWebpackConfig(storybookBaseConfig, includePaths) { - const newConfig = { ...storybookBaseConfig }; - - newConfig.module.rules = [ - ...storybookBaseConfig.module.rules, - { - test: /\.css$/, - use: [ - require.resolve('style-loader'), +export function createDefaultWebpackConfig(storybookBaseConfig) { + return { + ...storybookBaseConfig, + module: { + ...storybookBaseConfig.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'], + flexbox: 'no-2009', + }), + ], + }, + }, + ], + }, + { + test: /\.json$/, + loader: require.resolve('json-loader'), + }, { - loader: require.resolve('css-loader'), - options: { - importLoaders: 1, + test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/, + loader: require.resolve('file-loader'), + query: { + name: 'static/media/[name].[hash:8].[ext]', }, }, { - 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'], - flexbox: 'no-2009', - }), - ], + test: /\.(mp4|webm|wav|mp3|m4a|aac|oga)(\?.*)?$/, + loader: require.resolve('url-loader'), + query: { + limit: 10000, + name: 'static/media/[name].[hash:8].[ext]', }, }, ], }, - { - 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]', + resolve: { + ...storybookBaseConfig.resolve, + alias: { + ...(storybookBaseConfig.resolve && storybookBaseConfig.resolve.alias), + // This is to support NPM2 + 'babel-runtime/regenerator': require.resolve('babel-runtime/regenerator'), }, }, - ]; - - 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; } diff --git a/scripts/test.js b/scripts/test.js index a90f9098bc30..40d6ff255ae2 100755 --- a/scripts/test.js +++ b/scripts/test.js @@ -57,7 +57,7 @@ const tasks = { isJest: true, }), integration: createProject({ - name: `Screenshots of running apps ${chalk.gray('(integration)')}`, + name: `Screenshots of built apps ${chalk.gray('(integration)')}`, defaultValue: false, option: '--integration', projectLocation: path.join(__dirname, '..', 'integration'),