Skip to content

Commit

Permalink
Adds aliases to Storybooks webpack config for emotion 10 packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
webcore-it committed Mar 2, 2021
1 parent 85a510d commit 62465d1
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
const path = require("path");

// Location of root node_modules
const modulesDir = path.join(__dirname, '../node_modules');

// As long Storybook depends on emotion 10.
const emotion10Aliases = (config) => ({
...config,
resolve: {
...config.resolve,
alias: {
...config.resolve.alias,
'@emotion/core': path.join(modulesDir, '@emotion/react'),
'@emotion/styled': path.join(modulesDir, '@emotion/styled'),
'@emotion/styled-base': path.join(modulesDir, '@emotion/styled'),
'emotion-theming': path.join(modulesDir, '@emotion/react'),
},
},
});


module.exports = {
stories: [
'../src/**/*.stories.@(ts|tsx)',
],
addons: [],
webpackFinal: emotion10Aliases,
};

0 comments on commit 62465d1

Please sign in to comment.