#Javascript minify error with no explanation?

1 messages · Page 1 of 1 (latest)

small umbra
#

I am adding a feature to my application. The feature works fine in my demo/example (link below -- sidenote: is this an example that you would like in the dioxus examples repo?)

However, in my actual application I get this error at the end of dx bundle:

ERROR Failed to minify js. Falling back to non-minified: failed to bundle javascript with swc
INFO Copying asset (3/4): /.../frontend-dioxus/target/dx/frontend-dioxus/release/web/public/wasm-bindgen/frontend-dioxus.js

And then despite claiming that it copied the js asset, the application doesn't actually work when I open the webpage with this console error: Uncaught (in promise) TypeError: init is not a function. But I have no explanation of specifically what went wrong in the initial error message. Is there some way to get more details? I've narrowed down the error to this line from the demo (again, it works in the demo, just when I copy-paste this function into my actual application and use it, it gives the above error):
https://github.com/rogusdev/dioxus-examples/blob/main/zip-file/src/main.rs#L151

Any thoughts on what could be going wrong? Or what I need to do to get more output to debug this error?

Thanks.

GitHub

Examples with Dioxus. Contribute to rogusdev/dioxus-examples development by creating an account on GitHub.

ashen chasm
#

Try turning on the trace level in the CLI logging

small umbra
#

Which crate/namespace should I turn it on for to catch this? Or just blanket everything to see?...

ashen chasm
#

dioxus-cli-opt

#

IIRC you can just press t while the CLI is open

small umbra
#

Thanks. t did not do anything during the compiling of dx bundle, and none of these added any logs (in fact most took away the error message while still being broken): RUST_LOG=trace or RUST_LOG=dioxus-cli-opt=trace or RUST_LOG=dioxus-cli-opt=debug

#

To be explicit, here is my complete cmd, maybe I should be doing something different:
RUST_LOG=dioxus-cli-opt=trace DOMAIN=https://$HOSTNAME RUSTFLAGS="--cfg web_sys_unstable_apis" dx bundle --platform web --release (DOMAIN env var is for my app)

#

That line does the build and shows no additional logs, nor even the trace error -- but it still fails to build the js properly

ashen chasm
#

The log level for the CLI is set by DIOXUS_LOG

small umbra
#

That did add more output, however it does not seem especially revealing to me, unfortunately:

... (a bunch of lines like the below)

  19.932s DEBUG Resolving ./snippets/dioxus-web-bf44d47c344f35d0/inline1.js from Real(
    "/.../frontend-dioxus/target/dx/frontend-dioxus/release/web/public/wasm-bindgen/frontend-dioxus.js",
) for Browser
  19.933s DEBUG Resolving env from Real(
    "/.../frontend-dioxus/target/dx/frontend-dioxus/release/web/public/wasm-bindgen/frontend-dioxus.js",
) for Browser
  19.933s TRACE resolve_exports(/.../frontend-dioxus/target/dx/frontend-dioxus/release/web/public/wasm-bindgen/frontend-dioxus.js)
  19.934s ERROR Failed to minify js. Falling back to non-minified: failed to bundle javascript with swc
#

Is there anything in that which clarifies things in your mind? I assume that the resolve exports is failing, but not why

ashen chasm
#

Hmm, I'm not sure then...

small umbra
#

Haha

ashen chasm
#

If you open an issue with a link to the repo here, I might be able to tweak some swc settings to get it working or at least get a better error message

#

Currently finishing up some SEO docsite stuff, but the next few weeks will be focused on bug fixes

small umbra
#

Unfortunately I cannot share the actual repo, and my demo works fine... I will see if I can get it to break, but idk what the issue is...

#

But thank you for helping me out here as much as you have!

small umbra
#

I think I may have figured out the problem and I am trying to get a minimal repro

#

I can manually copy it into target/dx/dioxus-example-zip-file/release/web/public/ but I'd like to put it in a static or public folder or something and have it go there automatically

ashen chasm
#

Files in the asset folder are copied into the asset folder inside the bundle. Other than that, you could use a script

small umbra
#

Yeah assets I know. I suppose I could simply point at /assets/file.html ...