Cannot run ANY ESM modukes locally

522
1
02-02-2022 12:42 PM
corndog
New Contributor II

I am pulling my hair out trying to follow the documentation to create an extremely simple web-app using ESM (imports). It does NOT WORK and the documentation gives me NO info as to why.

No matter what I do, MapView ALWAYS GIVES THIS ERROR
Uncaught TypeError: Error resolving module specifier “luxon”. Relative module specifiers must start with “./”, “../” or “/”. languageUtils.js:5:508

Why is it not working, what are build tools and HOW do I USE them. I am just using plain Vanilla JavaScript and I have run npm init and npm install with node

npm init
npm install @arcgis/core

Why does the documentation not CLEARLY explain how to do this. Why is the documentation misleading or lacking, or both.

 

<html>

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

<body>
  <script type="module">
    import Map from "../node/node_modules/@arcgis/core/Map.js";
    import MapView from "../node/node_modules/@arcgis/core/views/MapView.js";

    const map = new Map();
    const view = new MapView({
        container: "viewDiv",
        map: map,
    });
  </script>
</body>

</html>

 

 

Tags (3)
0 Kudos
1 Reply
AndyGup
Esri Regular Contributor