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

[BUG] (v11) Unable to start Node.js app after build removed wrapper.mjs #820

Closed
2 tasks done
peterhirn opened this issue Oct 28, 2024 · 3 comments
Closed
2 tasks done
Labels

Comments

@peterhirn
Copy link

peterhirn commented Oct 28, 2024

Before you begin...

  • I have searched the existing issues
  • I am not using version 13.x of node (if so, please upgrade)

Description of the problem

Unclear if this is a bug here or in vinxi

Recipe for reproducing

pnpm create solid@latest -s solid-start-uuid-v11

  • template: basic
  • typescript: Yes
cd solid-start-uuid-v11
pnpm add uuid

Edit src/entry-server.tsx

import { v7 } from "uuid";
console.log(v7());
pnpm build
pnpm start
 ERROR  Cannot find module '/.../solid-start-uuid-v11/.output/server/node_modules/uuid/wrapper.mjs' imported from /.../solid-start-uuid-v11/.output/server/index.mjs              8:23:43 AM

  at finalizeResolution (node:internal/modules/esm/resolve:275:11)
  at moduleResolve (node:internal/modules/esm/resolve:932:10)
  at defaultResolve (node:internal/modules/esm/resolve:1056:11)
  at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:650:12)
  at #cachedDefaultResolve (node:internal/modules/esm/loader:599:25)
  at ModuleLoader.resolve (node:internal/modules/esm/loader:582:38)
  at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:241:38)
  at ModuleJob._link (node:internal/modules/esm/module_job:132:49)

Additional information

pnpm dev works as expected.

Environment

Node: v23.1.0

Workaround

pnpm patch uuid

diff --git a/package.json b/package.json
index 12ea33f0527be28f3d263ef32b5a189882b46455..8475de8aea93583640cbb7ebfa966ed262e27635 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,7 @@
       "node": {
         "module": "./dist/esm/index.js",
         "require": "./dist/cjs/index.js",
-        "import": "./wrapper.mjs"
+        "import": "./dist/esm/index.js"
       },
       "browser": {
         "import": "./dist/esm-browser/index.js",
@peterhirn peterhirn added the bug label Oct 28, 2024
@broofa
Copy link
Member

broofa commented Oct 28, 2024

Thanks for the report. I'm able to reproduce the issue. Looking into it.

@broofa
Copy link
Member

broofa commented Oct 28, 2024

@peterhirn So... technically I don't think this is an issue with uuid. Your error is complaining about there not being a "wrapper.mjs" in .output/server/node_modules/uuid, which is true...

$ ls .output/server/node_modules/uuid/wrapper.mjs
ls: .output/server/node_modules/uuid/wrapper.mjs: No such file or directory

... but the uuid package supplies that file, as seen in the top-level node_modules that pnpm installs:

$ ls node_modules/uuid/wrapper.mjs
node_modules/uuid/wrapper.mjs

So it looks like vinxi build is dropping that file on the floor for some reason.


That said, with the refactoring work that's gone into uuid@11, I'm not sure we need wrapper.mjs any more. I've opened #822 to look into removing it.

@broofa
Copy link
Member

broofa commented Oct 28, 2024

@peterhirn Fixed in #822, published in uuid@11.0.2. pnpm add uuid@latest should get you sorted out.

Note: It's still weird that vinxi isn't copying that wrapper.mjs file over, but probably not worth worrying about at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants