DEV Community

loading...

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

creativenull profile image Arnold Chand ・1 min read

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?

Discussion (1)

Collapse
kojikanao profile image
Koji (he/him)
// webpack config
resolve: {
  alias: {
    '~src': './src'
  }
}
// webpack config
resolve: {
  alias: {
    'packageName': './src'
  }
}
Forem Open with the Forem app