Skip to content

Commit

Permalink
Add workaround for Emotion 11
Browse files Browse the repository at this point in the history
  • Loading branch information
mirka committed Aug 11, 2021
1 parent 475fefa commit 00484b4
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
const path = require('path');

module.exports = {
core: {
builder: 'webpack5',
},
stories: [ '../@(src|stories)/**/*.stories.mdx', '../@(src|stories)/**/*.stories.@(js|jsx|ts|tsx)' ],
addons: [ '@storybook/addon-links', '@storybook/addon-essentials', '@storybook/preset-scss' ],
webpackFinal: ( config ) => {
config.module.rules.push( {
// Transpiles optional chaining in directly imported AsBlocks file
test: /node_modules\/asblocks\/src\//,
loader: 'babel-loader',
} );
// Workaround until Storybook supports Emotion 11
const toPath = ( _path ) => path.join( process.cwd(), _path );
config.resolve.alias = {
...config.resolve.alias,
'@emotion/styled': toPath( 'node_modules/@emotion/styled' ),
};

return config;
},
};

0 comments on commit 00484b4

Please sign in to comment.