Title: Cannot build wasm demo. Build fails at wasm-bindgen · Issue #3592 · RustPython/RustPython · GitHub
Open Graph Title: Cannot build wasm demo. Build fails at wasm-bindgen · Issue #3592 · RustPython/RustPython
X Title: Cannot build wasm demo. Build fails at wasm-bindgen · Issue #3592 · RustPython/RustPython
Description: When building the WASM demo app, I'm getting this error $ npm run dev ... i 「wds」: Project is running at http://localhost:8080/ i 「wds」: webpack output is served from / i 「wds」: Content not from webpack is served from C:\Projects\RustPyt...
Open Graph Description: When building the WASM demo app, I'm getting this error $ npm run dev ... i 「wds」: Project is running at http://localhost:8080/ i 「wds」: webpack output is served from / i 「wds」: Content not from we...
X Description: When building the WASM demo app, I'm getting this error $ npm run dev ... i 「wds」: Project is running at http://localhost:8080/ i 「wds」: webpack output is served from / i 「wds」: Content not fro...
Opengraph URL: https://github.com/RustPython/RustPython/issues/3592
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot build wasm demo. Build fails at wasm-bindgen","articleBody":"When building the WASM demo app, I'm getting this error\r\n\r\n```\r\n$ npm run dev\r\n...\r\ni 「wds」: Project is running at http://localhost:8080/\r\ni 「wds」: webpack output is served from /\r\ni 「wds」: Content not from webpack is served from C:\\Projects\\RustPython\\wasm\\demo\r\n[INFO]: Checking for the Wasm target...\r\n[INFO]: Compiling to Wasm...\r\nwarning: unused imports: `IntoPyResult`, `PyInt`\r\n --\u003e vm\\src\\exceptions.rs:1028:47\r\n |\r\n1028 | builtins::{traceback::PyTracebackRef, PyInt, PyTupleRef, PyTypeRef},\r\n | ^^^^^\r\n1029 | function::{FuncArgs, IntoPyResult},\r\n | ^^^^^^^^^^^^\r\n |\r\n = note: `#[warn(unused_imports)]` on by default\r\n\r\nwarning: unused import: `std::ops::Deref`\r\n --\u003e vm\\src\\exceptions.rs:1034:9\r\n |\r\n1034 | use std::ops::Deref;\r\n | ^^^^^^^^^^^^^^^\r\n\r\nwarning: unused import: `_io::io_open as open`\r\n --\u003e vm\\src\\stdlib\\io.rs:13:16\r\n |\r\n13 | pub(crate) use _io::io_open as open;\r\n | ^^^^^^^^^^^^^^^^^^^^\r\n\r\nwarning: `rustpython-vm` (lib) generated 3 warnings\r\n Finished dev [unoptimized + debuginfo] target(s) in 2.68s\r\n[INFO]: License key is set in Cargo.toml but no LICENSE file(s) were found; Please add the LICENSE file(s) to your project directory\r\n[INFO]: Installing wasm-bindgen...\r\nerror: failed to parse input file as wasm\r\n\r\nCaused by:\r\n 0: failed to parse code section\r\n 1: locals exceed maximum (at offset 18929596)\r\nError: Running the wasm-bindgen CLI\r\nCaused by: failed to execute `wasm-bindgen`: exited with exit code: 1\r\n full command: \"C:\\\\Users\\\\\u003cUSER\u003e\\\\AppData\\\\Local\\\\.wasm-pack\\\\wasm-bindgen-866ccfefff3842a2\\\\wasm-bindgen.exe\" \"C:\\Projects\\RustPython\\\\target\\\\wasm32-unknown-unknown\\\\debug\\\\rustpython_wasm.wasm\" \"--out-dir\" \"C:\\Projects\\RustPython\\\\wasm\\\\lib\\\\pkg\" \"--typescript\" \"--target\" \"bundler\" \"--out-name\" \"index\" \"--debug\"\r\n× 「wdm」: Hash: 4cbecc264801045dd3e3\r\n```\r\n\r\nUnsure about the root cause of this error, but it looks like `C:\\Projects\\RustPython\\target\\wasm32-unknown-unknown\\debug\\rustpython_wasm.wasm` is too big (170+MB) and hence wasm-bindgen is failing with `locals exceed maximum (at offset 18929596)`. This error results in an empty `pkg` directory that breaks `import('rustpython') in `index.js`\r\n\r\n\r\nCurrent workaround is to use the `WasmPackPlugin` in release configuration in `wasm/demo/webpack.conf.js`\r\n```\r\nconfig.plugins.push(\r\n new WasmPackPlugin({\r\n crateDirectory: path.resolve(__dirname, '../lib'),\r\n outDir: path.resolve(__dirname, \"../lib/pkg\"),\r\n forceMode: \"production\"\r\n })\r\n);\r\n```","author":{"url":"https://github.com/yashgorana","@type":"Person","name":"yashgorana"},"datePublished":"2022-04-08T10:17:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/3592/RustPython/issues/3592"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:376a6584-80ff-bf00-bf5c-8e65a4b62f3f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C89A:3F36AF:1E5D7A0:292837A:69734CC3 |
| html-safe-nonce | 3e86f7b05357f47e3bb980efb0e75035598823d06470cb4bf5dda7a87b8e5303 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDODlBOjNGMzZBRjoxRTVEN0EwOjI5MjgzN0E6Njk3MzRDQzMiLCJ2aXNpdG9yX2lkIjoiNjAwMzM5MzY4MzM5Mjc3NzQxMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2c11e382410a0fce9768a00a9b19ec5b4fd6261b7226b6eeda4172dae8323c9c |
| hovercard-subject-tag | issue:1197131116 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/RustPython/RustPython/3592/issue_layout |
| twitter:image | https://opengraph.githubassets.com/75ce85927e6c33d2de75c6e5032dff36e1f896fc47e35fa32f358ef1bddbb28a/RustPython/RustPython/issues/3592 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/75ce85927e6c33d2de75c6e5032dff36e1f896fc47e35fa32f358ef1bddbb28a/RustPython/RustPython/issues/3592 |
| og:image:alt | When building the WASM demo app, I'm getting this error $ npm run dev ... i 「wds」: Project is running at http://localhost:8080/ i 「wds」: webpack output is served from / i 「wds」: Content not from we... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | yashgorana |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9c6b49fea3d431063963fbeee3309a15cb4096903286e532f663096b47b63bc6 |
| turbo-cache-control | no-preview |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 814e1d7d82db0f7eb6982bfa0395502441bb14ad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width