GithubHelp home page GithubHelp logo

Comments (5)

dhh avatar dhh commented on August 11, 2024

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.

guybedford avatar guybedford commented on August 11, 2024

Note that .mjs is the preferred alternative extension to .js for modules and has a correctly registered MIME type unlike .jsm.

from importmap-rails.

mtgrosser avatar mtgrosser commented on August 11, 2024

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.

mildred avatar mildred commented on August 11, 2024

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.

tgaff avatar tgaff commented on August 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.