Skip to content

Instantly share code, notes, and snippets.

@the-teacher
Created July 16, 2020 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save the-teacher/3456ecbd18f1004fff2119cc279fbeaf to your computer and use it in GitHub Desktop.
Save the-teacher/3456ecbd18f1004fff2119cc279fbeaf to your computer and use it in GitHub Desktop.
module.exports = {
stories: ['../stories/**/*.stories.js'],
addons: ['@storybook/addon-actions', '@storybook/addon-links'],
webpackFinal: async config => {
/*
* Drop babel-loader for `.js|.md` pattern.
* (It's the first rule in the rules list.)
*
* It turned out that storybook had a conflict in the babel-loader configuration
* preset-env didn't set a value of `loose` property for one of plugins,
* it led to an internal babel error about mismatched `loose` value for another plugin
*
* Current solution is to drop babel-loader for .js|.md
* If you revert it back, make sure this bug is fixed (introduced in babel 7.10.2)
*
* Reference https://github.com/babel/babel/issues/11622
*/
config.module.rules.shift()
config.module.rules.push({
test: /\.js$/,
loader: 'babel-loader',
options: {
"presets": ["@babel/react"]
}
})
return config
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment