Comments (3)
The problem seems to be functional. When the import-map-overrides code loads for the first time, it reads the remote import map and stores the content in localStorage as-is (relative paths). If you then reload the page, the code takes the overrides from the localStorage and creates a new local import map with them, which it inserts dynamically in the page (
import-map-overrides/src/api/js-api.js
Line 429 in 052d1a1
The problem is that this dynamic import map is local and the relative paths are resolved from the current host (localhost) instead of the host from which of the original import map was downloaded.
Why does the code need to store the import map in the localStorage and then insert it dynamically? :thinking_face: (just trying to understand how it works)
I guess that is needed for the library to work. If that is the case, some possible solutions would be:
resolve and expand the URL of the override before storing it in the localStorage. In this way, when reloading it it would point to the correct remote URL
store in the local storage more structured data containing information about the original import map URL, so that we can resolve the URL when reloading the page and injecting the import map.
What is not clear to me is why, despite the fact that I have no overrides setup, the first time I load the page the library still saves in localStorage the content of the external override map that I load in the index.html page… 🤔
from import-map-overrides.
OK, I think I understood the problem. It's a very edge case. The overrides from the import map downloaded remotely in my example are all dev libs. They are added to the localStorage because the import-map-overrides changes all devLibs to their development version, by default (here).
This is what accidentally introduces the problem, due to the fact that, by modifying them and adding them back in as dynamic overrides, since they are relative URLs they become relative to the host, instead of being relative to the position of the original import map (as specified in the import map specs, here).
from import-map-overrides.
This has been resolved. Closing it.
from import-map-overrides.
Related Issues (20)
- Using import-map-overrides for making an 'in-browser' IDE. HOT 1
- Confusing reload icon after adding an override HOT 6
- IE 11 broken HOT 4
- Overrides triggers cross-origin issue when loaded into iframe (MS Teams) HOT 1
- buttons in ui can get "bad" styling HOT 1
- Failed to execute `attachShadow` on `Element` in 3.0.0 HOT 10
- Server-side single maps - cookie should specify a path HOT 1
- Bug introduced by terser HOT 1
- Is there a way to disable Auto Dev Lib Override? HOT 2
- how can i create E2E cypress tests? HOT 4
- Hi, I have this error in the console : Shadow root cannot be created on a host which already hosts a shadow tree. HOT 7
- Is it possible to support SystemJS and native imports at the same time? HOT 1
- Import maps blocked in Safari HOT 2
- cross-origin when trying to embed the single-spa app, with devtools enabled, in an iframe HOT 1
- Add configuration to control where the UI button is positioned HOT 4
- Attribute trigger-position does not have any effect HOT 3
- An import map is added after module script load was triggered. HOT 2
- When parsing an empty script tag of type importmap the parser throws an error. Is this OK?
- Warning while building import-map-overrides-server.js HOT 1
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 import-map-overrides.