Comments (6)
The CDN assets are our current recommended way of loading assets. Doing the local copy of assets will probably add to build times (dev and prod) and larger deployed sizes. Maybe you can add a readme note on how to do the local copy if needed, but I think you should leave the CDN assets as default.
from esri-svelte-example.
Thank you very much for that clarification @odoe. Now that I am reading this more critically:
For most local builds, the API's assets are pulled from the ArcGIS CDN at runtime and there is no need for additional configuration. The assets include styles, images, fonts and localization files. This behavior is based on the default setting for config.assetsPath.
https://developers.arcgis.com/javascript/latest/es-modules/#working-with-assets
... I do see how it implies that the recommended approach is to allow the assets to load from the CDN
from esri-svelte-example.
I'm now revisiting this topic as I'm faced with a project where we have to rely totally on locally managed assets. No CDN chatter allowed.
Firing up ncp
and setting up the esriConig.assetsPath
property all checks out to me, but have either of you figured out where to copy ArcGIS ESM assets with Vite?
The Vite docs about static assets https://vitejs.dev/guide/assets.html provide both great explanations along with interesting caveats. Maybe the /public
folder isn't quite the right spot? But if it is, I don't know how we'd have this line
esriConfig.assetsPath = "./assets";
point to the correct place if you're in dev mode or building for production (where it all ends up shifted to the /dist
folder).
Perhaps we'd rely on env vars? https://vitejs.dev/guide/env-and-mode.html#env-variables
from esri-svelte-example.
UPDATE: I think I've figured out the right combo and will report back with some notes once I just verify a few more things.
from esri-svelte-example.
@jwasilgeo not sure if you can even see this, but if so, how did you end up using static assets in Vite? or @gavinr, were you ever able to get static assets working in Vite?
from esri-svelte-example.
@samMatenaer as I recall it is doable. I think when I wrote the earlier comments/investigation above something wasn't that clear to me but then it started to click eventually. (I regret not updating this thread afterwards though.) I think it came down to each 3rd party library involved (3rd party from the perspective of Vite) might need its own handholding depending on certain criteria. Vite itself is great though. There should be some examples floating around in EsriPS I think? @gavinr @dhatcher
from esri-svelte-example.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esri-svelte-example.