Cannot find module 'dojo/dom'

1435
1
Jump to solution
11-22-2017 01:03 PM
Alexys_HerleymRodriguez_Avell1
New Contributor II

I am doing a personalized Widget. I configured all the folder and files related to the widget as is shown in this image:

My Zprevious Widget

.. but I have a problem finding the dojo/dom library using this code line:

import dom = require("dojo/dom");

The error messagge in the visual studio code window is: Cannot find module 'dojo/dom'

dojo/dom cannot find module

I used npm to aditionally install dojo/dom and its typings, but I cannot fix the accees to the library.

I do use the dojo/dom library accesing it directly from a HTML application using my local ArcGis Javascript Api 4.5, but in this case I am trying to use it inside a personalized Widget writtten in Typescript

Any suggestions?

Best regards!!

0 Kudos
1 Solution

Accepted Solutions
Alexys_HerleymRodriguez_Avell1
New Contributor II

I just review this [TypeScript - Setting up your development environment for Javascript Api 4.5] and [how to guide on how to develop with Dojo 1 in TypeScript using dojo/typings] and I realized that I just needed to change my tsconfig.json to:

{
    "compilerOptions": {
        "module": "amd",
        "noImplicitAny": true,
        "sourceMap": true,
        "jsx": "react",
        "jsxFactory": "tsx",
        "target": "es5",
        "experimentalDecorators": true,
        "preserveConstEnums": true,
        "suppressImplicitAnyIndexErrors": true
    },
    "include": [
        "./app/*"
    ],
    "exclude": [
        "node_modules"
    ]
}

Now Visual Studio Code recognize the module!

View solution in original post

1 Reply
Alexys_HerleymRodriguez_Avell1
New Contributor II

I just review this [TypeScript - Setting up your development environment for Javascript Api 4.5] and [how to guide on how to develop with Dojo 1 in TypeScript using dojo/typings] and I realized that I just needed to change my tsconfig.json to:

{
    "compilerOptions": {
        "module": "amd",
        "noImplicitAny": true,
        "sourceMap": true,
        "jsx": "react",
        "jsxFactory": "tsx",
        "target": "es5",
        "experimentalDecorators": true,
        "preserveConstEnums": true,
        "suppressImplicitAnyIndexErrors": true
    },
    "include": [
        "./app/*"
    ],
    "exclude": [
        "node_modules"
    ]
}

Now Visual Studio Code recognize the module!