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

Support Parcel #4142

Open
birkskyum opened this issue Aug 13, 2023 · 9 comments
Open

Support Parcel #4142

birkskyum opened this issue Aug 13, 2023 · 9 comments
Labels
bug Something isn't working napi Compatibility with the native layer of Node.js node.js Compatibility with Node.js APIs tracking-pkg Issues tracking support for a library or package

Comments

@birkskyum
Copy link
Collaborator

What version of Bun is running?

0.7.4+78defe7a87226b5b10766e24fae458a62811dab2

What platform is your computer?

Darwin 22.5.0 arm64 arm

What steps can reproduce the bug?

Make an index.html file:

<html>
  <head>
    <title>My First Parcel App</title>
  </head>
  <body>
    <h1>Hello, World!</h1>
  </body>
</html>

Run bun --bun x parcel index.html

What is the expected behavior?

bun --bun x parcel index.html 
Server running at http://localhost:1234Built in 2ms

This is the case if --bun flag is removed

What do you see instead?

bun --bun x parcel index.html
[bun] Warning: worker_threads.Worker option "execArgv" is not implemented.
dyld[63445]: missing symbol called
error: "parcel" exited with code 9 (SIGKILL)

Additional information

Related to

@birkskyum birkskyum added the bug Something isn't working label Aug 13, 2023
@Electroid Electroid added the node.js Compatibility with Node.js APIs label Sep 9, 2023
@birkskyum
Copy link
Collaborator Author

Now I get:

➜ bun --bun x parcel index.html
3592 |         // $FlowFixMe
3593 |         (0, ($parcel$interopDefault($5VgCY$fs))).statSync = (filename)=>{
3594 |             return this.fs.statSync(filename);
3595 |         };
3596 |         try {
3597 |             m.load(filePath);
                   ^
TypeError: m.load is not a function. (In 'm.load(filePath)', 'm.load' is undefined)
      at load (/private/tmp/parcel@latest--bunx/node_modules/@parcel/package-manager/lib/index.js:3597:13)
      at processTicksAndRejections (:61:77)

17 |   try {
18 |     binding = require('./build/Release/watcher.node');
19 |   } catch (err) {
20 |     try {
21 |       binding = require('./build/Debug/watcher.node');
22 |     } catch (err) {
                                                                                                                                                                                                                                                                                                                                        ^
error: No prebuild or local build of @parcel/watcher found. Tried @parcel/watcher-darwin-arm64. Please ensure it is installed (don't use --no-optional when installing with npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.
      at /private/tmp/parcel@latest--bunx/node_modules/@parcel/watcher/index.js:22:324
      at anonymous (native:1:1)
      at /private/tmp/parcel@latest--bunx/node_modules/@parcel/fs/lib/index.js:7:5
      at anonymous (native:1:1)
      at /private/tmp/parcel@latest--bunx/node_modules/@parcel/package-manager/lib/index.js:10:5
      at anonymous (native:1:1)
      at /private/tmp/parcel@latest--bunx/node_modules/@parcel/core/lib/worker.js:63:1
      at anonymous (native:1:1)
      at /private/tmp/parcel@latest--bunx/node_modules/@parcel/workers/lib/child.js:108:32
      at childInit (/private/tmp/parcel@latest--bunx/node_modules/@parcel/workers/lib/child.js:107:25)
17 |   try {
18 |     binding = require('./build/Release/watcher.node');
19 |   } catch (err) {
20 |     try {
21 |       binding = require('./build/Debug/watcher.node');
22 |     } catch (err) {

@KTamas
Copy link

KTamas commented Jan 4, 2024

@birkskyum I might be wrong and can't test it right now, but you may need to add @parcel/watcher to trustedDependencies in your package.json because only the top 500 packages get their postinstall scripts ran automatically and my guess is that it may not be on that list.

@birkskyum
Copy link
Collaborator Author

@KTamas , thank you for the tip - I tried just now but I can't make it work.

@chdominguez
Copy link

Any news on this? I cannot seem to make parcel work when installed with bun.

@KTamas
Copy link

KTamas commented Feb 14, 2024

Yeah I'm still waiting on it as well.

@koddr
Copy link

koddr commented May 8, 2024

The same problems with Bun v1.1.7 and Parcel bundler v2.12.0:

🙏

@jtenner
Copy link

jtenner commented May 9, 2024

I hit similar trouble using bunx --bun parcel

It just looks like a napi feature hasn't been implemented yet. Perhaps someone might be able to point me in the right direction to get this working?

It's blocking me from using bun at work with parcel.

Edit: I meant to say "point me in the right direction to help contribute to this issue..."

Might be time to learn some zig?

@jtenner
Copy link

jtenner commented May 9, 2024

Also, I wanted to point out that @parcel/watch requires the use of detect-libc.

This wouldn't normally be a problem but...

> await import("detect-libc")
Object [Module] {
  GLIBC: 'glibc',
  MUSL: 'musl',
  default: {
    GLIBC: 'glibc',
    MUSL: 'musl',
    family: [Function: family],
    familySync: [Function: familySync],
    isNonGlibcLinux: [Function: isNonGlibcLinux],
    isNonGlibcLinuxSync: [Function: isNonGlibcLinuxSync],
    version: [Function: version],
    versionSync: [Function: versionSync]
  },
  family: [Function: family],
  familySync: [Function: familySync],
  isNonGlibcLinux: [Function: isNonGlibcLinux],
  isNonGlibcLinuxSync: [Function: isNonGlibcLinuxSync],
  version: [Function: version],
  versionSync: [Function: versionSync]
}

This actually looks fine, and uses a function to find the libc family. However, parcel uses the detect-libc package which doesn't expect family to be a function.

let name = `@parcel/watcher-${process.platform}-${process.arch}`;
if (process.platform === 'linux') {
  const { MUSL, family } = require('detect-libc');
  if (family === MUSL) {
    name += '-musl';
  } else {
    name += '-glibc';
  }
}

As you can see here, family is a function and will never equal MUSL, and thus, we get some issues.

We can solve this problem by calling await import("@parcel/watcher") instead of using import watcher from "@parcel/watcher", and I think this is unintended behavior.

@birkskyum
Copy link
Collaborator Author

birkskyum commented Aug 20, 2024

Now getting:

bun --bun x parcel index.html
3619 |                     (0, ($parcel$interopDefault($aniHR$module)))._extensions[".js"](m, filename);
3620 |                 };
3621 |             }
3622 |         }
3623 |         try {
3624 |             m.load(filePath);
                     ^
TypeError: m.load is not a function. (In 'm.load(filePath)', 'm.load' is undefined)
      at load (/private/tmp/bunx-501-parcel@latest/node_modules/@parcel/package-manager/lib/index.js:3624:15)

Error: symbol 'napi_register_module_v1' not found in native module. Is this a Node API (napi) module?

@nektro nektro added napi Compatibility with the native layer of Node.js tracking-pkg Issues tracking support for a library or package labels Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working napi Compatibility with the native layer of Node.js node.js Compatibility with Node.js APIs tracking-pkg Issues tracking support for a library or package
Projects
None yet
Development

No branches or pull requests

7 participants