Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I generate only the .wasm file and nothing else? #1043

Open
Directory opened this issue Aug 1, 2021 · 2 comments
Open

How do I generate only the .wasm file and nothing else? #1043

Directory opened this issue Aug 1, 2021 · 2 comments

Comments

@Directory
Copy link

I am trying to incorporate this within webpack. I do not want to use any of the baby step cripple autogenerated js files because those are unnecasary http requests that need to be loaded into the browser. i am using the webpack WasmPackPlugin library. my plugin setting is as follows.

new WasmPackPlugin({
  crateDirectory: './src/rust_lib',
  outDir: path.resolve(__dirname, 'dist'),
  extraArgs: "--no-typescript --target web",
})

i have my hello world rust code inside of src/rust_lib. i want it to compile the .wasm file in dist. ONLY the .wasm file. right now in its current state it trys to make a package and generates a .gitignore, index.js, and package.json. i do not want an npm package. i will be loading the index_bg.wasm file directly from my main js. theres no need for a pointless http req made to get index.js only to load the wasm. i know i could ignore the file and load it directly anyway but the contents of dist are exposed in production and its important only whats needed is present. I also just want to have a clean setup with no clutter.

What i have tried so far is scowering the docs for args to do this. i got rid of the ts files with --no-typescript and tried setting all kinds of different targets but it still tries to generate a package. How do i make it only generate the stand alone .wasm binary?

@antonok-edm
Copy link

antonok-edm commented Oct 22, 2021

Related: #865, #811

@ranile
Copy link
Contributor

ranile commented May 30, 2023

This is impossible. You need the JS glue code to load the wasm file properly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants