Static GitHub Issues

[2558] Nested node_modules are ignored.

prev: About [Add webpack plugins]. How to add some special attributes to my js files ?
next: Unable to access Store in mounted hook after page refresh

I ran into an issue where a package had it's own node_modules, and webpack was ignoring it and instead trying to bundle the package from the root node_modules (which made it error in my case). The reason this happens is because when resolve.modules is an absolute path, it will no longer resolve nested node_modules.

The relevant piece of code is in lib/common/options.js:

 // Populate modulesDir
  options.modulesDir = []
    .concat(join(options.nuxtDir, 'node_modules'))
    .concat(options.modulesDir)
    .filter(dir => hasValue(dir))
.map(dir => resolve(options.rootDir, dir))

To test this, I added options.modulesDir.unshift("node_modules"); at the end of this for webpack to prioritize nested node_modules.

I'm not entirely sure what commit introduced this bug, as this was working fine in 1.0.0-gh-b31b0f2 and broke in the latest 1.0.0.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This bug report is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2224">#c2224</a>)</em></sub></div>