Esri / esri-loader

A tiny library to help load ArcGIS API for JavaScript modules in non-Dojo applications
Apache License 2.0
457 stars 79 forks source link

Esri sources don't get loaded from our server #288

Closed GeofoxCoding closed 2 years ago

GeofoxCoding commented 2 years ago

Expected behavior

esri-loader should load sources from local server in current version 3.4.0

Actual behavior

We had to change a project that utilized esri-loader to load the esri sources and assets from our own server.

esri-loader gets passed a web server directory:

setDefaultOptions({ 
    url: backendUrl.protocol + '//' + backendUrl.hostname + '/rips/common/esri/4.22/esri',
    css: backendUrl.protocol + '//' + backendUrl.hostname + '/rips/common/esri/4.22/esri/css/main.css'
});

Because url points to a server directory it only receives a directory browsing (if activated) page. Is there a default script that should be loaded inside /esri ?

The URL matches and resides on the same server. image image image

It seems like esri-loader also only receives the directory browsing page. What does the esri-loader expect to be returned from .../esri/4.22/esri ?

GeofoxCoding commented 2 years ago

I'm one step further now once I found in another ticket, that I have to target init.js in setDEfaultOptions({ url: '.../init.js', ... }).

After also enabling wasm files at my webserver it now seems to load the sources correctly from local server but my css is still loaded from js.arcgis.com

image

Is there also something else I have to enable for css? With my defaultOptions(...) example above I was following your current documentation but as written I had to point to init.js instead.

I also want to link. #216

andygup commented 2 years ago

@GeofoxCoding did you try loadCss()?

import { loadCss } from 'esri-loader';
loadCss('http://server/path/to/esri/css/main.css');
GeofoxCoding commented 2 years ago

@andygup I'm sorry this was my fault. I forgot the styles referenced in index.html.

Works! Thank you very much.