Copy link to clipboard
Copied
I'm trying to use node moduels like 'open ' and 'svgo' but i get this error "Unexpacted token import " the moment i require these modules, knowing that I'm already using some other modules like
{
"name": "com.test.server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"body-parser": "^1.18.2",
"express": "^4.16.3",
"fs": "^0.0.1-security",
"open": "^8.4.0",
"request": "^2.85.0",
"svgo": "^2.8.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Copy link to clipboard
Copied
Unexpected token import? Hmm does the svgo have the same kind of file being imported as the ones that are working?
I wonder if there's an issue with the ones that are not svgo using commonJS and svgo maybe using esm or something.
Copy link to clipboard
Copied
thanks silly-v , i tried to use the svgo module just alone but I get the same error the moment I require the module
Copy link to clipboard
Copied
Yes, are you able to dig into the node_modules and examine the exact files which are being imported to detect a difference which may shed some light on just this import keyword issue. In the case that your normally working items are all a certain way that svgo is not, it may be possible then to somehow make edits and rectify such a difference.