rails / importmap-rails

Use ESM with importmap to manage modern JavaScript in Rails without transpiling or bundling.
MIT License
1.07k stars 120 forks source link

Some file are missing / Not included #252

Open ColiZei opened 6 months ago

ColiZei commented 6 months ago

Hello,

i use the @event-calendar/core package in a project and it depends on 3 svelte packages.

It works fine by CDN with this configuration:

# importmap.rb
pin "@event-calendar/core", to: "https://ga.jspm.io/npm:@event-calendar/core@2.7.1/index.js"
pin "svelte", to: "https://ga.jspm.io/npm:svelte@4.2.17/src/runtime/index.js"
pin "svelte/internal", to: "https://ga.jspm.io/npm:svelte@4.2.17/src/runtime/internal/index.js"
pin "svelte/store", to: "https://ga.jspm.io/npm:svelte@4.2.17/src/runtime/store/index.js"
pin "@event-calendar/time-grid", to: "https://ga.jspm.io/npm:@event-calendar/time-grid@2.7.1/index.js"
pin "@event-calendar/interaction", to: "https://ga.jspm.io/npm:@event-calendar/interaction@2.7.1/index.js"

But if i try to download it, this is the result (preload added manually):

# importmap.rb
pin "@event-calendar/core", to: "@event-calendar--core.js", preload: true # @2.7.1
pin "svelte", preload: true # @4.2.17
pin "svelte/internal", to: "svelte--internal.js", preload: true # @4.2.17
pin "svelte/store", to: "svelte--store.js", preload: true # @4.2.17
pin "@event-calendar/time-grid", to: "@event-calendar--time-grid.js", preload: true # @2.7.1
pin "@event-calendar/interaction", to: "@event-calendar--interaction.js", preload: true # @2.7.1

Now i got missing files and the project breaks.

image

image

If i check the CDN, there are exports and import for this files. But now they cant be found?

Example from (https://ga.jspm.io/npm:svelte@4.2.17/src/runtime/index.js):

export{SvelteComponentDev as SvelteComponent, [...] }from"./internal/index.js";import"../../_/4brMrzAu.js";import"../../_/5Rbsx6qL.js";
//# sourceMappingURL=index.js.map

Any help for this?

Thank you!

ColiZei commented 6 months ago

Updated example.

mngb commented 2 months ago

I face the same issue. I solve this by copy files from node_modules/[js-lib]/dist/[js-file] to vendor/javascript/. Seems the command "bin/importmap pin [js-lib]" download wrong js files.