Closed sepehr500 closed 1 year ago
HI @sepehr500, thanks for the question. In order to help you, we need some more details on your setup. Specifically a step-by-step replication case that we can follow that will show me the issue. For example:
mkdir arcigs-rest-js-demo
cd arcgis-rest-js-demo
npm init
npm install @esri/arcgis-rest-request
If you post a replication case like the above, I'd be happy to try it out and see if I get the same issue as you.
@sepehr500 This is probably happening because of a mismatch between how you are importing the files and how your package.json is setup.
For example:
If you are using ES modules:
import { searchItems } from "@esri/arcgis-rest-portal";
Then you need to have "type": "module"
set in your package.json
,
If you are using common JS
const { searchItems } = require("@esri/arcgis-rest-portal");
Then you can omit "type": "module"
or set "type": "commonjs"
Since @tsconfig/node18
is setting "module": "node16",
on your tsconfig.json
you need to follow Nodes module resolution rules in your files for loading Common JS vs ESM modules.
If this still doesn't work then we will need a full reproduction case that we can run locally.
Thanks. I will give this a shot
That worked! Thanks.
Describe the bug
Hello. I am trying to import
@esri/arcgis-rest-request
into my nodejs application written in typescript. I get the following error,Unless I set
"moduleResolution": "node10"
.But this gives me the error
tsconfig.lib.json(5,25): error TS5109: Option 'moduleResolution' must be set to 'Node16' (or left unspecified) when option 'module' is set to 'Node16'.
Because node10 is incompatible with
@tsconfig/node18/tsconfig.json
I am on typescript 5.2.2. Using
"@tsconfig/node18": "^18.2.1"
My tsconfig looks like this
Reproduction
Create a project with the tsconfig listed above and dependencies listed above.
Logs
No response
System Info
Additional Information
No response