#Deno Emit

10 messages · Page 1 of 1 (latest)

deep delta
#

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?

#

Here is the deno.json as well

#

And here is the bundle

#

deno bundle code is also bigger by about 100 lines or so hmm

#

If using ```ts
const bundled = await bundle(src, { importMap: './deno.json', compilerOptions: { jsxFactory: 'preact.h' } });

Suggested 'preact.h' factory, the following error pops up
#

Basically same as React

charred bronzeBOT
#

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. 🦕

vagrant stirrup
#

I don't think you can use deno bundle for browser environment.

deep delta