Skip to content

Support Webpack 4 (e.g. for Create React App) #11

Closed
@webmaster128

Description

@webmaster128

When trying to use this lib from npm in a React project, I get the error

Failed to compile.

./node_modules/drand-client/verifying.js 16:29
Module parse failed: Unexpected token (16:29)
File was processed with these loaders:
 * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|         // TODO: switch to TinyGo when math/big works for smaller wasm file and non-global exports.
|         const go = new Go();
>         const url = `${import.meta.url.split('/').slice(0, -1).join('/')}/wasm/drand.wasm`;
|         let result;
|

This is because import.meta.url is not supported in Webpack 4. Webpack 5 support probably will take some more time.

I have no great idea how to solve this, but let's see.

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