Deno Emit
How come does
deno bundle work a lot differently to Deno emit (https://deno.land/x/emit@0.28.0 )? When I try to bundle my react code, the code bundled by deno bundle works just fine, while the emit code is broken?
10 Replies
Here is the
deno.json as well
And here is the bundle
deno bundle code is also bigger by about 100 lines or so hmmIf using
Suggested 'preact.h' factory, the following error pops up
Basically same as React
The
Deno.emit() API and deno bundle command serve different purposes and work in different ways, which could explain the difference in the output of your React code.
The Deno.emit() API was designed to allow transpiling and bundling source code programmatically. However, as per the documentation, this API was considered unstable and didn't fit well in the Deno namespace due to its complexity and the subtle edge cases it introduced. As a result, it was removed from the Deno namespace and provided as a userland module: deno_emit.
On the other hand, the deno bundle command was designed to output a single JavaScript file for consumption in Deno, which includes all dependencies of the specified input. However, it's important to note that deno bundle has been deprecated and will be removed in some future release. The documentation recommends using deno_emit, esbuild, or rollup instead.
The difference in the output of your React code could be due to the different ways these tools handle bundling. If you're experiencing issues with deno_emit, it might be worth checking if you're using the latest version, or if there are known issues with the version you're using.
Remember, deno_emit is a userland module and might not handle all cases as deno bundle does. If you're having specific issues with deno_emit, it might be worth raising an issue in the module's repository or seeking help from the Deno community. 🦕I don't think you can use
deno bundle for browser environment.
But it does work though aye
Well, they said depends on the input, but it's up to you to decide if you want to check carefully every API and lib you will use for client or you will use a different tool.