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

Webpack gives error while bundling modules having "main", "module" or "js:next" attributes set to "." in their package.json #123

Closed
webpack-bot opened this issue Nov 28, 2017 · 3 comments · Fixed by #183

Comments

@webpack-bot
Copy link

Let us assume I am using a module named do-something in my package.json as a dependency. This module has package.json with entry attributes like

"main": ".",
"module": ".",
"jsnext:main": ".",

While doing bundling for this module through webpack, I get this error
Module not found: Error: Recursion in resolving

I am in an assumption that, the "main": "." attribute path will resolve to "main": "index.js"
I am suspecting webpack is calling do-something module folder again and again.

I investigated more and it is coming from enhanced-resolve package that webpack uses for resolving paths. I use webpack major version 2 "webpack": "^2.4.0"

But I have tried with the latest webpack version as well, it still does not work. Is there a way in webpack to bundle these kinds of dependent modules?


This issue was moved from webpack/webpack#6026 by @sokra. Orginal issue was by @aakashkharche04.

Looks like a bug.

@benderTheCrime
Copy link

+1 on this @sokra. I've had a similar problem recently with the Jest ecosystem. My thoughts on this are that, at very least, if the target for bundling is "node," Webpack should support all of the quirks of the NodeJS module resolver.

@eaviles
Copy link

eaviles commented Dec 15, 2017

I just reported this issue in Jest too.
jestjs/jest#5088

aminland added a commit to aminland/Array.prototype.flatten that referenced this issue Feb 24, 2018
This package can't be included right now with webpack (Jest also has a similar issue).

While it's a bug in webpack, this package is not usable by any web app right now that bundles with webpack.
webpack/enhanced-resolve#123

By switching the "main" entry in package.json, this package will be compatible with all resolvers (and also conform to the same pattern as every other repo in the es-shim org)
aminland added a commit to aminland/Array.prototype.flatten that referenced this issue Feb 24, 2018
This package can't be included right now with webpack (Jest also has a similar issue).

While it's a bug in webpack, this package is not usable by any web app right now that bundles with webpack.
webpack/enhanced-resolve#123

By switching the "main" entry in package.json, this package will be compatible with all resolvers (and also conform to the same pattern as every other repo in the es-shim org)
@ljharb
Copy link

ljharb commented Feb 24, 2018

./ is something that node understands; it's absurd that webpack doesn't handle it, for all targets.

What would it take to get this fixed?

ljharb pushed a commit to aminland/Array.prototype.flatten that referenced this issue Feb 24, 2018
…lvers

This package can't be included right now with webpack (Jest also has a similar issue).

While it's a bug in webpack, this package is not usable by any web app right now that bundles with webpack.
webpack/enhanced-resolve#123

By switching the "main" entry in package.json, this package will be compatible with all resolvers
ljharb added a commit to es-shims/Array.prototype.flatMap that referenced this issue Feb 24, 2018
…lvers

This package can't be included right now with webpack (Jest also has a similar issue).

While it's a bug in webpack, this package is not usable by any web app right now that bundles with webpack.
webpack/enhanced-resolve#123

By switching the "main" entry in package.json, this package will be compatible with all resolvers

From es-shims/Array.prototype.flat#3
sokra added a commit that referenced this issue Jul 4, 2019
@sokra sokra mentioned this issue Jul 4, 2019
@sokra sokra closed this as completed in #183 Jul 4, 2019
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 a pull request may close this issue.

4 participants