I feel this is a bug using the ES Module for React, please take a look and confirm.
I'm trying to use the new ES Module on a React app (@Anonymous User/core), I followed the documentation doing this:
1. npm install @Anonymous User/core
2. inside the package.json, I added the script for coping the assets to the public folder generated by webpack (I'm using create-react-app) --> "copy": "ncp ./node_modules/@arcgis/core/assets ./public/assets"
This is the issue, inside the React app I'm using declarative routing (react-router-dom) and when placing the map component inside of a root path http://myapp.com/map, it works pretty well, and no error to load the map.
but when placing the map inside of a subpath http://myapp.com/main/mapthe map is not able to load and it breaks showing the error:
Refused to execute script from 'http://localhost:3003/main/assets/esri/core/workers/RemoteClient.js' because its MIME type ('text/html') is not executable.
if you check the error and the URL the error is throwing, the Arcgis Map (@Anonymous User/core) is trying to get the copied assets from the folder /public/main/assets and not for the /public/assets where it should always find them. And that's because the map was located inside the route /main/map.