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

project fails to import uuid package #87

Closed
pi0 opened this issue Apr 12, 2022 · 3 comments
Closed

project fails to import uuid package #87

pi0 opened this issue Apr 12, 2022 · 3 comments

Comments

@pi0
Copy link
Member

pi0 commented Apr 12, 2022

Environment

Operating System: Linux
Node Version: v17.1.0
Nuxt Version: 3.0.0-27319101.3e82f0f
Package Manager: npm@8.1.2
Bundler: Vite
User Config: -
Runtime Modules: -
Build Modules: -

Reproduction

  1. Add server/api/test.ts
import { v4 } from "uuid";

export default () => {
  return v4();
};

Describe the bug

Building the project causes the package uuid to fail to be imported. The problem does not exist when running the dev server.

Cannot find module '/home/me/dev/nuxt3-app/.output/server/node_modules/uuid/wrapper.mjs' imported from /home/me/dev/nuxt3-app/.output/server/chunks/test.mjs
  at new NodeError (node:internal/errors:371:5)  
  at finalizeResolution (node:internal/modules/esm/resolve:394:11)  
  at moduleResolve (node:internal/modules/esm/resolve:915:10)  
  at defaultResolve (node:internal/modules/esm/resolve:1005:11)  
  at ESMLoader.resolve (node:internal/modules/esm/loader:475:30)  
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:245:18)  
  at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:40)  
  at link (node:internal/modules/esm/module_job:78:36)

Additional context

Moved from nuxt/nuxt#13040

Logs

No response

@pi0 pi0 added bug Something isn't working dependency-issue and removed bug Something isn't working labels Apr 12, 2022
@dargmuesli
Copy link
Contributor

Happens for ws v8 too.

@dargmuesli
Copy link
Contributor

I debugged a bit and saw that at

const tracedFiles = await nodeFileTrace(Array.from(trackedExternals), opts.traceOptions)
only .js and .json files are returned.
https://github.com/vercel/nft however seems like it works with .mjs files and like it can detect an exports.import statement, as the one by ws, too...

I'm not that used to low level packages like these, so that's where my understanding left for now.

@pi0
Copy link
Member Author

pi0 commented May 16, 2024

latest version of nitro seems inlining uuid

@pi0 pi0 closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants