Jonathan Le Maire
Jonathan Le Maire

Reputation: 1

Imask - How to install in VS code?

First time trying to install a library in a project. I found this library as a suggestion to mask input fields in my form. I consulted this page : https://imask.js.org/guide.html and tried what is explained there but can't get it to work :(

I get this error message :

TypeError: Failed to resolve module specifier "imask". Relative references must start with either "/", "./", or "../".

index.html

<script type="module" src="js/script.js"></script>

script.js

import IMask from 'imask';

I tried changing the import path in the script.js file :

import IMask from '../node_modules/imask';

and it gave me this error message : Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

Then, I tried this path :

import IMask from '../node_modules/imask/dist/imask';

and it gave me this error message : GET http://000.0.0.0:0000/node_modules/imask/dist/imask 404 (Not Found)

Upvotes: 0

Views: 42

Answers (0)

Related Questions