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 deno #7108

Open
tiloio opened this issue Oct 16, 2021 · 14 comments
Open

Support deno #7108

tiloio opened this issue Oct 16, 2021 · 14 comments

Comments

@tiloio
Copy link

tiloio commented Oct 16, 2021

🙋 feature request

Make parcel work with Deno.

🤔 Expected Behavior

  • We can use the @parcel/core API with Deno.
  • We can build the parcel CLI with Deno and provide a executable of the CLI with deno compile.
    Because of that we don't need npm or yarn anymore do use parcel.

😯 Current Behavior

The CLI is only useable via npm and yarn.

If I use @parcel/core with Deno

import * as Parcel from "https://unpkg.com/@parcel/core@2.0.0/lib/index.js";

const bundler = new Parcel.Parcel({
    entries: 'output.js',
    config: 'parcel-config.json'
});

it fails:

error: Uncaught ReferenceError: exports is not defined
Object.defineProperty(exports, "__esModule", {
                      ^
    at https://unpkg.com/@parcel/core@2.0.0/lib/index.js:3:23

💁 Possible Solution

  • Maybe an ESM Version of @parcel/core is able to run with Deno.
  • Maybe parcel can already be build with Deno via the Deno Node.js compatibility.

🔦 Context

Deno provides a far better developer experience than node. I want to be able to build a website without using node or npm.

Because of Deno deploy I would like to be able to do server side rendering (SSR) with Deno via Parcel. With that I want to build #transitionalapps.

@tiloio tiloio changed the title Deno support Support deno Oct 16, 2021
@0x1af2aec8f957
Copy link

Are there any plans to support Deno now?

@devongovett
Copy link
Member

It would be cool but I don't personally have time to work on it. We'd accept contributions though if anyone is interested!

@rawkakani
Copy link

It would be cool but I don't personally have time to work on it. We'd accept contributions though if anyone is interested!

Hi @devongovett would you have some time to provide some suggestions of the best way to go about implementing this support

@niedzielski
Copy link

Just sharing that I tried using the NPM module on Deno v1.34.0 and it fails with a different error in case it's helpful:

deno run -A npm:parcel
TypeError: fs.findAncestorFile is not a function
    at $10671d0be444e08b$export$7eca4ea16d4c8343 (file:///home/stephen/node_modules/.deno/@parcel+utils@2.9.1/node_modules/@parcel/utils/lib/index.js:36705:23)
    at resolveOptions (file:///home/stephen/node_modules/.deno/@parcel+core@2.9.1/node_modules/@parcel/core/lib/resolveOptions.js:88:59)
    at eventLoopTick (ext:core/01_core.js:182:11)
    at async Parcel._init (file:///home/stephen/node_modules/.deno/@parcel+core@2.9.1/node_modules/@parcel/core/lib/Parcel.js:144:27)
    at async Parcel.watch (file:///home/stephen/node_modules/.deno/@parcel+core@2.9.1/node_modules/@parcel/core/lib/Parcel.js:228:7)
    at async run (file:///home/stephen/node_modules/.deno/parcel@2.9.1/node_modules/parcel/lib/cli.js:286:9)

@mischnic
Copy link
Member

See denoland/deno#16460

@rawkakani
Copy link

@mischnic are you able to give any hints what is wrong based on the error mentioned here

@mischnic
Copy link
Member

mischnic commented May 30, 2023

Doesn't really look Parcel specific though, supports-color (probably used by chalk which our CLI uses) calls has-flag which reads process.argv which might not exist in Deno? https://unpkg.com/browse/has-flag@4.0.0/index.js

@rawkakani
Copy link

Doesn't really look Parcel specific though, supports-color (probably used by chalk which our CLI uses) calls has-flag which reads process.argv which might not exist in Deno? https://unpkg.com/browse/has-flag@4.0.0/index.js

interesting, thank you for the input

@bartlomieju
Copy link

Hey folks, Bartek from the Deno team here. We're working through the problems one-by-one to support running Parcel in Deno. It appears we're really close on this one. I'll keep you posted.

@arendjr
Copy link

arendjr commented Oct 4, 2023

@bartlomieju Any update on this?

I figured I'd give it a go just now, using the following custom parcel.ts in my project:

import * as Parcel from "npm:@parcel/core";

const bundler = new Parcel.Parcel({
    config: '.parcelrc',
    targets: ['public/index.html']
});

bundler.run();

But got the following messages:

error: Uncaught (in worker "$DENO_STD_NODE_WORKER_THREAD") (in promise) Error: Only create ThreadsChild instances in a worker!
    at new ThreadsChild (file:///home/arendjr/Projects/monofiber/studio/node_modules/.deno/@parcel+workers@2.9.3/node_modules/@parcel/workers/lib/threads/ThreadsChild.js:34:13)
    at new Child (file:///home/arendjr/Projects/monofiber/studio/node_modules/.deno/@parcel+workers@2.9.3/node_modules/@parcel/workers/lib/child.js:65:18)
    at Object.<anonymous> (file:///home/arendjr/Projects/monofiber/studio/node_modules/.deno/@parcel+workers@2.9.3/node_modules/@parcel/workers/lib/threads/ThreadsChild.js:49:27)
    at Object.<anonymous> (file:///home/arendjr/Projects/monofiber/studio/node_modules/.deno/@parcel+workers@2.9.3/node_modules/@parcel/workers/lib/threads/ThreadsChild.js:50:4)
    at Module._compile (node:module:733:34)
    at Object.Module._extensions..js (node:module:747:10)
    at Module.load (node:module:658:32)
    at Function.Module._load (node:module:539:12)
    at Module.require (node:module:677:19)
    at require (node:module:791:16)
error: Uncaught (in promise) Error: Unhandled error in child worker.
    at Worker.#pollControl (ext:runtime/11_workers.js:159:19)
    at eventLoopTick (ext:core/01_core.js:183:11)

@bartlomieju
Copy link

@arendjr I'm working on a fix for this bug, follow denoland/deno#20613 for updatesd.

@robvanvolt
Copy link

Any updates on this?:)

@mischnic
Copy link
Member

See denoland/deno#20613 (comment)

@zzz6519003
Copy link

deno deploy + parcel template pls

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