DEV Community

Arnold Chand
Arnold Chand

Posted on

How do you name your webpack/parcel/etc aliases?

Bundlers such as webpack have an option to replace your relative paths with aliases. I've seen some articles and tutorial where they use either @ prefix or capitalizing the first letter of the relative path, like App/ or Components/.

For me I started using @ prefixes at the beginning but then started to experiment around with # prefixes instead for my projects.

// webpack config
resolve: {
  alias: {
    '#app': './src'
  }
}
Enter fullscreen mode Exit fullscreen mode

I'm interested to know what you use as your webpack (or any other bundler) aliases? Or if you don't use them at all?

Top comments (1)

Collapse
 
0xkoji profile image
0xkoji
// webpack config
resolve: {
  alias: {
    '~src': './src'
  }
}
// webpack config
resolve: {
  alias: {
    'packageName': './src'
  }
}