Comments (5)
This explores similar territory to #57. I've been hesitant on #57, though. It feels like a lot to solve a little. Maybe we could simply allow .js(m|x)?
as the extension instead. I'd find that much easier to merge.
from importmap-rails.
Note that .mjs
is the preferred alternative extension to .js
for modules and has a correctly registered MIME type unlike .jsm
.
from importmap-rails.
If other filename extensions than .js
are to be allowed, the list of accepted extensions needs to be taken into account in four different places:
- Directory expansion (
pin_all_from
), when scanning the filesystem - Module name derivation
- Module path derivation
- Cache sweeping, during watcher initialization
#57 has been updated to provide this, while keeping the accepted extensions in one place.
From there, making the extensions configurable instead of hardcoding them adds four more lines, ensuring compatibility of import maps with the (still) existing asset pipeline.
from importmap-rails.
The fact is that some packages out there are not using the plain .js
extension, and to be able to use them we need to be able to pin other extensions.
For example chart.js main module name is chart.mjs
. Once downloaded in the vendor directory, in the default configuration the pinning does not work.
from importmap-rails.
The preference for .mjs
for modules comes from V8: https://v8.dev/features/modules#mjs It's likely widely followed.
from importmap-rails.
Related Issues (20)
- Import_maps going to wrong directory
- Importmap:install loads rakefile twice
- asset_path('es-module-shims.min') does not work in production HOT 1
- files ending in `_index.js` have `index` replaced with an empty string HOT 3
- Why do certain pins disappear in production? HOT 2
- Unpin command causing net error HOT 3
- Confusing message on 'update'
- Unable to unpin HOT 1
- Persistent 404 error when pinning HOT 11
- Package works when pinned from JSPM but not when downloaded HOT 2
- Break in iOS 16.2 when upgrading from 1.2.3 to 2.0.1 HOT 4
- turbo:load event not fired anymore in test environment after upgrade from 1.2.3 to 2.0.1 HOT 3
- Feature suggestion: optional `process.env` polyfill
- Multiple importmaps HOT 6
- Importmap update removes pins via http HOT 1
- importmap pin/update removes preload: false
- ga.jspm.io never updates HOT 3
- ./bin/importmap outdated command fails with undefined method `dig' for an instance of String HOT 6
- Add option to `bin/importmap pin URL` to create direct/remote link without downloading
- Option to 're-sync' vendor folder HOT 2
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 importmap-rails.