Skip to content

Build error when using a WebAssembly module #408

@mstange

Description

@mstange

Webpack 4 supports modules written in WebAssembly. Here's a commit that adds such a module to the offline-plugin-pwa example:

mstange/offline-plugin-pwa@a4b2fdf

However, when using offline-plugin on a project with WebAssembly modules, the offline-plugin build fails:

$ npm run build

> [email protected] build /Users/mstange/code/offline-plugin-pwa
> webpack --log-level=debug

ℹ 「webpack」: Starting Build
➤ 「webpack」: Input File System Purged
✖ 「command」: A webpack error occured while building: use --log-level=debug for more error detail
✖ 「command」: The "data" argument must be one of type string, TypedArray, or DataView. Received type object
➤ 「command」: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be one of type string, TypedArray, or DataView. Received type object
    at Hash.update (internal/crypto/hash.js:58:11)
    at Object.getHashDigest (/Users/mstange/code/offline-plugin-pwa/node_modules/offline-plugin/node_modules/loader-utils/index.js:248:7)
    at /Users/mstange/code/offline-plugin-pwa/node_modules/offline-plugin/lib/index.js:465:45
    at Array.forEach (<anonymous>)
    at OfflinePlugin.setHashesMap (/Users/mstange/code/offline-plugin-pwa/node_modules/offline-plugin/lib/index.js:460:39)
    at emitFn (/Users/mstange/code/offline-plugin-pwa/node_modules/offline-plugin/lib/index.js:276:18)
    at _err1 (eval at create (/Users/mstange/code/offline-plugin-pwa/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:17:1)
    at callback (/Users/mstange/code/offline-plugin-pwa/node_modules/copy-webpack-plugin/dist/index.js:77:17)
    at /Users/mstange/code/offline-plugin-pwa/node_modules/copy-webpack-plugin/dist/index.js:118:24
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `webpack --log-level=debug`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mstange/.npm/_logs/2018-08-23T20_52_47_372Z-debug.log

You can reproduce this by checking out the add-wasm branch in my offline-plugin-pwa fork and running npm install && npm run build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions