Skip to content

Instantly share code, notes, and snippets.

@whoisryosuke
Last active October 11, 2019 18:26
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 whoisryosuke/21c7bc238d5f020732d622cb3018890d to your computer and use it in GitHub Desktop.
Save whoisryosuke/21c7bc238d5f020732d622cb3018890d to your computer and use it in GitHub Desktop.
Storybook / Webpack - How to add relative aliasing (@component/Button vs '../../component/Button`)
const path = require('path')
module.exports = ({ config, mode }) => {
// Adds absolute paths to imports
config.resolve.alias = {
...config.resolve.alias,
'@components': path.resolve(__dirname, '../src/components'),
'@assets': path.resolve(__dirname, '../src/assets'),
'@helpers': path.resolve(__dirname, '../src/helpers'),
'@layouts': path.resolve(__dirname, '../src/layouts'),
'@templates': path.resolve(__dirname, '../src/templates'),
}
return config
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment