Skip to content

Can't import the named export (imported as 'wasm') #143

@bart-krakowski

Description

@bart-krakowski

Hi!
I used wasm-pack build command and I'm getting the following error:

ERROR in ./src/wasm-lib/pkg/index_bg.js 15:14-29

wasm-pack-plugin: Can't import the named export (imported as 'wasm') from default-exporting module (only default export is available)

The ./src/wasm-lib/pkg/index_bg.js file is auto-generated and looks like this:

import * as wasm from './wasm_lib_bg.wasm';

/**
* @param {number} left
* @param {number} right
* @returns {number}
*/
export function sort_array(left, right) {
    const ret = wasm.sort_array(left, right);
    return ret >>> 0;
}

I also added the syncWebAssembly flag to my Webpack config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions