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.

Error finding modules import with an alias and extensions resolve in Webpack

See original GitHub issue

While running jsdoc command, the error 'Error: Cannot find module ‘components/base/header/Header’ is thrown because I’m using the “@” alias and the rules of resolve extentions of my Webpack config. So I import the child components with that kind of pattern in my Vue components : import Header from ‘@/components/base/header/Header’

Is it expected that you will consider such rules in the future ?

Thank you for this plugin

Error: Cannot find module 'components/base/header/Header' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at evalmachine.<anonymous>:11:15 at ContextifyScript.Script.runInContext (vm.js:35:29) at module.exports (/Users/myrmel/Documents/LocalDev/webv2/node_modules/jsdoc-vuejs/lib/vueComponentPrototypeExtractor.js:20:10) at beforeParse (/Users/myrmel/Documents/LocalDev/webv2/node_modules/jsdoc-vuejs/index.js:20:47) at emitOne (events.js:96:13) at emit (events.js:188:7) at Parser._parseSourceCode (/Users/myrmel/Documents/LocalDev/webv2/node_modules/jsdoc/lib/jsdoc/src/parser.js:248:14) at Parser.parse (/Users/myrmel/Documents/LocalDev/webv2/node_modules/jsdoc/lib/jsdoc/src/parser.js:179:18) at Object.module.exports.cli.parseFiles (/Users/myrmel/Documents/LocalDev/webv2/node_modules/jsdoc/cli.js:370:42) at module.exports.cli.main (/Users/myrmel/Documents/LocalDev/webv2/node_modules/jsdoc/cli.js:239:14) at Object.module.exports.cli.runCommand (/Users/myrmel/Documents/LocalDev/webv2/node_modules/jsdoc/cli.js:189:5) at /Users/myrmel/Documents/LocalDev/webv2/node_modules/jsdoc/jsdoc.js:105:9 at Object.<anonymous> (/Users/myrmel/Documents/LocalDev/webv2/node_modules/jsdoc/jsdoc.js:106:3)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Kocalcommented, Oct 12, 2017

Mmmh yea why not.

I see something like that for JSDoc config:

{
  "plugins": [
    "node_modules/jsdoc-vuejs"
  ],
  "vuejs": {
    "followRequire": false, 
   },
  "source": {
    "includePattern": "\\.(vue|js)$"
    // or
    "include": [
       "foo.vue",
       "bar/test.vue'
    ]
  }
}

Also, I need to modify lib/vueComponentPrototypeExtractor.js. I will work on that this week-end I think

0reactions
MyrtoMcommented, Oct 13, 2017

Thank you so much, this is great, very usefull !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve | webpack
resolve.alias. object. Create aliases to import or require certain modules more easily. For example, to alias a bunch of commonly used src/ folders:....
Read more >
Webpack doesn't resolve properly my alias - Stack Overflow
To have it work for the library's import calls as well, I had to do: webpackConfig.resolve.alias = { mobx: path.resolve(root, "node_modules" ...
Read more >
resolve.alias not works · Issue #4160 · webpack ... - GitHub
Error : Cannot find module 'Actions/app' ... at Object.require.extensions. ... Aliases are absolute nonsense for resolving imports.
Read more >
Module Resolution or Import Alias: The Final Guide - Raul Melo
First, let's check what problem we're trying to solve, a solution in a more abstract way and how to configure your project to...
Read more >
Webpack Aliases Keep My Code Sane - DEV Community ‍ ‍
If you are resolving your code in combination with webpack inside of Babel, ESLint or TypeScript, you may need to update their config...
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