agorushkin
agorushkin16mo ago

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?
No description
10 Replies
agorushkin
agorushkinOP16mo ago
Here is the deno.json as well
No description
agorushkin
agorushkinOP16mo ago
And here is the bundle
No description
agorushkin
agorushkinOP16mo ago
deno bundle code is also bigger by about 100 lines or so hmm
agorushkin
agorushkinOP16mo ago
If using
const bundled = await bundle(src, { importMap: './deno.json', compilerOptions: { jsxFactory: 'preact.h' } });
const bundled = await bundle(src, { importMap: './deno.json', compilerOptions: { jsxFactory: 'preact.h' } });
Suggested 'preact.h' factory, the following error pops up
No description
agorushkin
agorushkinOP16mo ago
Basically same as React
Deno AI Helper
Deno AI Helper16mo ago
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. 🦕
Đăng Tú
Đăng Tú16mo ago
I don't think you can use deno bundle for browser environment.
Đăng Tú
Đăng Tú16mo ago
No description
agorushkin
agorushkinOP16mo ago
But it does work though aye
Đăng Tú
Đăng Tú16mo ago
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.

Did you find this page helpful?