Created
March 31, 2017 13:32
-
-
Save doque/b12ac55a8d6771141ccbb5def4437bae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('babel-register'); | |
const path = require('path'); | |
const cssLoaders = require('../webpack.config.babel.js').cssLoaders; | |
// Overrides the Storybook Base Webpack Config | |
module.exports = function (storybookBaseConfig, configType) { | |
// 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. | |
console.log(`🤖 storybook is building for ${configType}`); | |
const isProd = configType === 'PRODUCTION'; | |
// Enable usage of SASS Modules | |
storybookBaseConfig.module.loaders.push( | |
{ | |
test: /.scss$/, | |
// Storybook needs to explicitly enable style-loader | |
loaders: [ 'style-loader' ].concat(cssLoaders), | |
include: path.resolve(__dirname, '../') | |
}, | |
{ | |
test: /\.(eot|svg|ttf|woff|woff2|html)$/, | |
exclude: /node_modules/, | |
loaders: [ 'file-loader' ], | |
}, | |
{ | |
test: /.json$/, | |
loaders: [ 'json-loader' ] | |
} | |
); | |
storybookBaseConfig.output.publicPath = 'http://localhost:6006/'; | |
storybookBaseConfig.devtool = isProd ? 'source-map' : 'eval'; | |
return storybookBaseConfig; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment