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

Module parse failed: Unexpected section: 0xc #1092

Open
Uzay-G opened this issue May 15, 2022 · 2 comments
Open

Module parse failed: Unexpected section: 0xc #1092

Uzay-G opened this issue May 15, 2022 · 2 comments

Comments

@Uzay-G
Copy link

Uzay-G commented May 15, 2022

Related: webpack/webpack#14087

When building my functional wasm package, I get:

Hash: 964659855f4448e72a10
Version: webpack 4.42.0
Time: 807ms
Built at: 05/15/2022 8:16:20 PM
 2 assets
Entrypoint index = index.js
[0] ./js/index.js 47 bytes {0} [built]
[1] ./pkg/index.js 97 bytes {1} [built]
[2] ./pkg/index_bg.js 21.4 KiB {1} [built]
[3] ./pkg/index_bg.wasm 1.86 KiB {1} [built] [failed] [1 error]
[4] (webpack)/buildin/harmony-module.js 573 bytes {1} [built]
[5] (webpack)/buildin/global.js 472 bytes {1} [built]

ERROR in ./pkg/index_bg.wasm
Module parse failed: Unexpected section: 0xc
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
Error: Unexpected section: 0xc
    at new CompileError (/home/halcyon/Documents/Projects/hora-wasm/node_modules/@webassemblyjs/helper-api-error/lib/index.js:40:109)
    at parseSection (/home/halcyon/Documents/Projects/hora-wasm/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1678:11)
    at Object.decode (/home/halcyon/Documents/Projects/hora-wasm/node_modules/@webassemblyjs/wasm-parser/lib/decoder.js:1696:25)
    at decode (/home/halcyon/Documents/Projects/hora-wasm/node_modules/@webassemblyjs/wasm-parser/lib/index.js:248:21)
    at WebAssemblyParser.parse (/home/halcyon/Documents/Projects/hora-wasm/node_modules/webpack/lib/wasm/WebAssemblyParser.js:74:19)
    at /home/halcyon/Documents/Projects/hora-wasm/node_modules/webpack/lib/NormalModule.js:482:32
    at /home/halcyon/Documents/Projects/hora-wasm/node_modules/webpack/lib/NormalModule.js:358:12
    at /home/halcyon/Documents/Projects/hora-wasm/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/home/halcyon/Documents/Projects/hora-wasm/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/home/halcyon/Documents/Projects/hora-wasm/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/home/halcyon/Documents/Projects/hora-wasm/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /home/halcyon/Documents/Projects/hora-wasm/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /home/halcyon/Documents/Projects/hora-wasm/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
 @ ./pkg/index.js 1:0-40 3:0-21
 @ ./js/index.js

ERROR in chunk 1
6fbbd28fd493aeebb54a.module.wasm
/home/halcyon/Documents/Projects/hora-wasm/pkg/index_bg.wasm
unexpected end

How can I trouble-shoot / fix this?

@gustavohenke
Copy link

#918 seems to provide some useful steps

@Feel-ix-343
Copy link

Feel-ix-343 commented Jul 12, 2022

This issue has come up for me with webpack 5.70

3hrs of debugging later I figured out that webpack version 5.66 works

what a pain

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