Created
February 11, 2021 14:30
-
-
Save C-Sinclair/25debf95fd44a096ac7079d79f1df9b2 to your computer and use it in GitHub Desktop.
Adding aliases to Storybook's webpack config
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
const path = require("path"); | |
module.exports = { | |
stories: [ | |
// "../stories/**/*.stories.mdx", | |
// "../**/**/*.stories.@(js|jsx|ts|tsx)", | |
"../components/**/*.stories.tsx", | |
], | |
addons: [ | |
"@storybook/addon-links", | |
"@storybook/addon-essentials", | |
"@storybook/preset-scss", | |
], | |
webpackFinal: async (config) => { | |
const alias = { | |
config: path.resolve(__dirname, "../config"), | |
utils: path.resolve(__dirname, "../utils"), | |
store: path.resolve(__dirname, "../store"), | |
constants: path.resolve(__dirname, "../constants"), | |
components: path.resolve(__dirname, "../components"), | |
containers: path.resolve(__dirname, "../containers"), | |
}; | |
return { | |
...config, | |
resolve: { | |
...config.resolve, | |
alias: { ...config.resolve.alias, ...alias }, | |
}, | |
}; | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment