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 universal path alias in webpack.partial.conf.resolve #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anicarrr
Copy link

Always wanted to add this to the skeleton. It is useful when you are deep in the folder structure. It's more powerful with typescript.

@ThaNarie
Copy link

Personally I'm not a big fan of this:

  • it's not needed if you have auto-import
  • every tool that "analyses" your code needs to configure those aliases as well (typescript, eslint, etc)

@ReneDrie
Copy link
Collaborator

We had something similar like this before right (~)? But this was removed because of reasons I don't know

@ThaNarie
Copy link

@ReneDrie Are you not confused with the css-loader?

To import assets from a node_modules path (include resolve.modules) and for alias, prefix it with a ~:

url(~module/image.png) => require('module/image.png')
url('~module/image.png') => require('module/image.png')
url(~aliasDirectory/image.png) => require('otherDirectory/image.png')

Or did we have something similar for JS as well?

@anicarrr
Copy link
Author

assets don't have auto-import

@ThaNarie
Copy link

In my opinion, if possible, assets should live in the same "folder" as the code that uses it.
So we would only have this for more global assets that are used in multiple components?

We already have asset: path.resolve(config.projectRoot, 'src/asset'), for specifically that purpose, so with that I don't see the added benefit of an alias to the src folder itself.

Could you convince me otherwise? :)

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

Successfully merging this pull request may close these issues.

None yet

3 participants