-
-
Notifications
You must be signed in to change notification settings - Fork 498
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
Serverless fails to bundle modules when using pnpm #1953
Comments
Are there any leads for this, I would be happy to support :) |
@patrickhaug Curious to know as well if someone wants to take a lead for using |
@noelforte Same same. But I guess I can not look into it the next days .. |
Have an update on this. I read through https://pnpm.io/faq#pnpm-does-not-work-with-your-project-here in more detail and after looking though the workarounds, I'm less convinced that this issue has to do with dependency hoisting, as using My best guess is that when bundling, the To reiterate what I think the root of the issue is: When installing/bundling with NPM, the function file for require("@11ty/eleventy");
require("@11ty/eleventy-img");
require("@swc/core");
require("cssnano");
require("htmlnano");
require("luxon");
require("markdown-it");
require("postcss");
require("postcss-preset-env");
require("posthtml");
require("sass");
require("svgo");
require("yaml"); but when using require('.pnpm'); Since requiring It would be really helpful to get some traction on this issue in the coming months for those of us that use |
I was able to trace the issue back to |
Nice catch! |
Not sure how many we are using/trying to use pnpm..... So adding 1 😃 |
Describe the bug
I use
pnpm
to manage mynode_modules
and have encountered a bug with Eleventy Serverless that occurs when the project is usingpnpm
, most likely due to the nature of the structure ofnode_modules
being a virtual store that hard links to a global store.When a serverless bundle is generated from a project that is using
pnpm
, the resulting bundle fails to execute properly with the error:[11ty] > Cannot find module '.pnpm'
. Further inspection of the error shows that within the bundle itself, ineleventy-app-config-modules.js
the following statement is made:which is different than what's placed there when the project is using
npm
:Raw Output from
netlify dev
To Reproduce
Steps to reproduce the behavior:
pnpm
:$ npm i -g pnpm
$ cd <project>
eleventy
Expected behavior
When running with
npm
/npx
the resulting bundle can be previewed (ie with$ netlify dev
) or deployed without issues or errors by including correct dependencies (in this case looks to be missingrequire('@11ty/eleventy')
Environment:
Ubuntu 20.04.2 LTS (Focal Fossa)
using kernel5.4.72-microsoft-standard-WSL2
v1.0.0-canary.41
Additional context
My next step for trying to tackle this bug is to look into the workarounds documented here: https://pnpm.io/faq#pnpm-does-not-work-with-your-project-here
I'm no Node expert by any means, but this appears to be a direct result of modules not resolving correctly due to a different-than-expected
node_modules
structure.The text was updated successfully, but these errors were encountered: