Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add './src' as a default resolve path #1015

Closed
codebryo opened this issue Mar 20, 2018 · 1 comment
Closed

Add './src' as a default resolve path #1015

codebryo opened this issue Mar 20, 2018 · 1 comment

Comments

@codebryo
Copy link

codebryo commented Mar 20, 2018

What problem does this feature solve?

As the app grows, managing the dependencies should be as simple and consistent as possible.
With complexity and multiple folders it can be tedious to travers through all the paths using relative references.

import Bar from '../../components/foo/Bar'
// Better
import Bar from 'components/foo/Bar'

This is super simple to do in Webpack.
Currently I create a config file looking like this:

module.exports = {
  chainWebpack: config => {
    config.resolve.modules.add("./src");
  }
};

What does the proposed API look like?

Adding ./src to the default webpack config would make this easier for many people and prevent some errors for some developers as the path can always be used from the actual src folder.

@Akryum
Copy link
Member

Akryum commented Mar 20, 2018

You can already write:

import Bar from '@/components/foo/Bar'

IMHO this is even better because it's more explicit that it's from the source code and not from a node_modules package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants