How to specify custom build command? #829
Replies: 4 comments
-
There was a discussion on Discord about wasm64. IIRC the conclusion was that it could be done, but not really be tested due to the fact that wasm64 required some nightly stuff and "bring your own" when it came to tooling. Still, it might make sense to raise a tracking issue for that and see where all of this is today. |
Beta Was this translation helpful? Give feedback.
-
Currently, Trunk is hardcoded to build for wasm32. However, you can work around this limitation by using custom build commands and hooks within Trunk. One approach is to specify a custom build command in your Trunk.toml configuration. This allows you to use any command you need for building your wasm64 target. For example, you can add [build] command = "cargo build --target wasm64-unknown-unknown --release" to your Trunk.toml. If you need to perform any specific steps before the build, such as setting up environment variables or running custom scripts, you can use the pre-build hook like [hooks] pre-build = "your_pre_build_script.sh". Similarly, if you need to perform any actions after the build, you can use the post-build hook like [hooks] post-build = "your_post_build_script.sh". Alternatively, if you want to completely disable the wasm32 build and use custom scripts for building wasm64, you can create a custom script that handles the entire build process for wasm64. For example, you can create a script build_wasm64.sh with the content cargo build --target wasm64-unknown-unknown --release. You can then integrate this with Trunk by invoking your custom script manually before running Trunk with ./build_wasm64.sh and then trunk serve. By using these approaches, you can leverage Trunk for your project while customizing the build process to support wasm64 and wasi. |
Beta Was this translation helpful? Give feedback.
-
I created an issue here: #830 Correct me if I'm wrong, but |
Beta Was this translation helpful? Give feedback.
-
There's PR #831, which will allow disabling the Rust build with a In any case, I think having wasm64 support would make perfect sense. |
Beta Was this translation helpful? Give feedback.
-
I'm playing around with wasm64 and wasi, would love to use Trunk but it seems hardcoded to build for wasm32. Is there any way to specify a custom build command? Or to disable wasm32 build and use hooks to build for wasm64/wasi?
Beta Was this translation helpful? Give feedback.
All reactions