Benk I
Benk I

Reputation: 199

How to solve referenceerror module is not defined

I am trying to import asva-js-password-package client side as below

<script src="https://unpkg.com/@marcusfernstrom/[email protected]/index.js"></script>

But I am getting a referenceerror module is not defined in the browser console. How can I solve this?

Upvotes: 1

Views: 3440

Answers (1)

Jordan Breton
Jordan Breton

Reputation: 1327

You can't with this file alone.

The module have not been written in es6 module style, but in CommonJS. If you want to import this file as is, it wont works unless you import a library that support this syntax (like requireJS).

Another solution can be to compile this file with a JS transpiler like browserify that will produce a file browser compatible.

Upvotes: 3

Related Questions