I'm trying to import wellknown in to my JavaScript file by doing import * as *wellknown* from "node/querystring";
but I keep getting this error:
Cannot use import statement outside a module
I have tried to change import to require, and I even added type module to my package.json file, but nothing helped.
I did my npm install in my console and it says up to date. I even tried to put it in to an <script>
, but I couldn't figure out the src. I tried something like this:
<script type="module" src="node_modules/wellknown/wellknown.js"></script>
.
How can I fix it?
This is my package.json file:
{
"name": "app",
"version": "1.0.0",
"type": "module",
"dependencies": {
"node": "^17.7.2",
"wellknown": "^0.5.0"
}
}