question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[idea] Aliases for moduleRoots

See original GitHub issue

Hi and thx for a good tool! I like to use webpack aliases in my Vue projects (for example: https://github.com/vuejs-templates/webpack/blob/master/template/build/webpack.base.conf.js#L21-L29), but when I trying use something like import Module from '@/myComponent/file', I get error module @/myComponent/file was not found.
And Yes, I have moduleRoots in my package.json. It work perfect for other cases.

May be possible, make some aliases in moduleRoots? For example:

{
"moduleRoots": [ "src/", {"@": "src/components/"} ]
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

19reactions
lexanthcommented, Nov 8, 2017

@aaronatmycujoo Over a month later, but if you’re still interested, I added support for webpack aliases in my branch: https://github.com/alexanthony/js-hyperclick

5reactions
existe-dejacommented, Jan 4, 2018

If you have a webpack configuration from the webpack template of vue-cli, follow this steps:

  1. Install alexanthony’s fork
  2. Go to the settings of the package in atom prefs
  3. Check Resolve with webpack
  4. Add build/webpack.base.conf.js in the field Webpack configuration filename

No need of moduleRoots entry in package.json.

Great work @alexanthony!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a canonical way to set up prefixed @ / ~ aliases?
Situation In projects, we're using a variety of different ways to set up aliases: webpack (simple and complex) typescript (.tsconfig)...
Read more >
Module Resolution or Import Alias: The Final Guide - Raul Melo
Tired to have weird imports? It's time to learn how can you enable aliases to your imports and let code more organized.
Read more >
Smart JS GoTo - Visual Studio Marketplace
This extension lets you jump to your files, even if they're aliased through webpack, typescript, or other tools.
Read more >
Essentials · The Julia Language
Within a module, you can control which names from other modules are visible (via importing), and specify which of your names are intended...
Read more >
android/src/com/android/tools/idea/wizard/TemplateWizardState ...
Suffix added by default to activity names */ ... File moduleRoot = new File(projectRoot, (String)get(NewProjectWizardState.ATTR_MODULE_NAME));.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found