denoflare icon indicating copy to clipboard operation
denoflare copied to clipboard

deno.jsonc ignored?

Open JustinGrote opened this issue 3 years ago • 9 comments

Trying to use import maps to replace my deps.ts file. https://deno.land/[email protected]/npm_nodejs/import_maps

Works just fine with deno run, however when I use denoflare I get an export module undefined. It appears it is ignoring my deno.jsonc?

JustinGrote avatar Oct 25 '22 21:10 JustinGrote

yea you are in uncharted territory there - are you wanting to use in denoflare serve, denoflare push, both?

Shouldn't be too difficult, just would need to config or pass the path to deno.jsonc (or mimic deno's automagic which I'm not necessarily too keen on)

johnspurlock-skymethod avatar Oct 25 '22 22:10 johnspurlock-skymethod

@JustinGrote mind sending me or posting an example project including your import maps?

johnspurlock-skymethod avatar Nov 05 '22 21:11 johnspurlock-skymethod

@JustinGrote mind sending me or posting an example project including your import maps?

I actually bailed on Denoflare and went back to Wrangler and node. It's the standard import map examples I linked in previous post.

JustinGrote avatar Nov 05 '22 22:11 JustinGrote

Alright, will reopen if there are more people blocked on it. Personally I still use deps.ts

johnspurlock-skymethod avatar Nov 05 '22 22:11 johnspurlock-skymethod

@johnspurlock-skymethod wanted to revisit this now that I'm trying to come back to Denoflare. Looking at the code, since denoflare generates its own temp deno config file when you run deno bundle, if there was a way to inject additional deno command line options like --import-map, that would solve my problem. Alternatively allow a way to provide a deno.json file that would be merged with yours, or support import-map option as part of .denoflare config.

Basically I just need a way to pass --import-map to denoflare bundle, whatever that looks like, whenever a serve or push happens.

My preference would be to supply my own deno.json, with a option similar to --bundle being my preferred 2nd alternative. I could attempt a PR on this if you let me know how you would like it designed.

JustinGrote avatar Dec 09 '22 21:12 JustinGrote

There are two "backends" when doing internal bundling in Denoflare, since the excellent Deno.emit API in earlier Deno versions was abruptly removed and replaced with a not quite ready to use external module which does not (and probably will not) ever support the same features. See the gory details in Denoflare's bundle.ts.

So when running on recent Deno versions, I actually call deno bundle under the hood by default (you can still try out the other backends using a command line option) - not ideal, since it spawns another process and therefore needs exec permission.

All that to say I'd like to keep the option open to returning to an in-process bundle, if the external module ever reaches parity - so I want to be conservative about adding too many new compiler options etc that wouldn't be available outside of deno bundle.

I'd be fine with adding an --import-map to serve/push - unless you can think of specific other features in the deno.json file that are crucial to carry over as well.

johnspurlock-skymethod avatar Dec 09 '22 23:12 johnspurlock-skymethod

I think the main case here would be to whenever we're running denoflare and we find a deno.json{c} it should be taken into consideration. importMaps is one of the changes I had to make in my project to make it work, so I had to completely ignore it to make denoflare to work and re-wrote most of my imports to consume directly from the deps.ts file which is honestly not that convenient if you have a project already working.

thebergamo avatar May 20 '23 07:05 thebergamo

This is a blocker for my project since it depends on import maps for externals. Like it was stated in the description of this issue, it works fine on deno run Has anyone found a workaround either with denoflare or wrangler?

fnhipster avatar Jun 23 '23 22:06 fnhipster

👋 everyone, I'm pretty busy at the moment - but if folks want me to prioritize this, head over to Support this project and donate to help fund development.

johnspurlock-skymethod avatar Jun 23 '23 23:06 johnspurlock-skymethod