Last active
March 29, 2020 20:16
-
-
Save majirosstefan/28faf027803c27c3066857dcb73c63ea to your computer and use it in GitHub Desktop.
This file contains hidden or 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
module.exports = { | |
stories: ['../storybook/stories/index.js'], | |
webpackFinal: async config => { | |
config.resolve.alias = { | |
...(config.resolve.alias || {}), | |
// Transform all direct `react-native` imports to `react-native-web` | |
'react-native$': 'react-native-web', | |
// make sure we're rendering output using **web** Storybook not react-native | |
'@storybook/react-native': '@storybook/react', | |
// plugin-level react-native-web extensions | |
'react-native-svg': 'react-native-svg/lib/commonjs/ReactNativeSVG.web', | |
// ... | |
}; | |
// handle SVG support inside Storybook | |
const fileLoaderRule = config.module.rules.find(rule => | |
rule.test.test('.svg'), | |
); | |
fileLoaderRule.exclude = /\.svg$/; | |
config.module.rules.push({ | |
test: /\.svg$/, | |
loader: 'svg-react-loader', | |
}); | |
// mutate babel-loader | |
config.module.rules[0].use[0].options.plugins.push([ | |
'react-native-web', | |
{commonjs: true}, | |
]); | |
// console.dir(config, { depth: null }); | |
return config; | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment