jspm / generator

JSPM Import Map Generator
Apache License 2.0
160 stars 20 forks source link

Generator for vue return a bundled version for bundler #325

Closed RemiDesgrange closed 8 months ago

RemiDesgrange commented 8 months ago

I tried to generate a simple import map with only vue3. I can reproduce here: https://generator.jspm.io/#U2RhYGBkDM0rySzJSU1hKCtNdTDWM9YzAQAyVb4/GAA

The payload I sent to the API:

{"install":["vue@3"]}

According to the vue doc the proper build to use is vue.esm-browser.js (and vue.esm-browser.prod.js for production).

I tried with all the provider (jspm, jsdelivr, esm.sh, unpkg) they all gave the same result.

I'm I missing something here?

guybedford commented 8 months ago

Thanks for posting here. JSPM will just follow what is defined in the package "exports". In the case of this Vue version we have:

"exports": {
    ".": {
      "import": {
        "types": "./dist/vue.d.mts",
        "node": "./index.mjs",
        "default": "./dist/vue.runtime.esm-bundler.js"
      },
      "require": {
        "types": "./dist/vue.d.ts",
        "default": "./index.js"
      }
    }
  }

Therefore, for the main entry point it will use the dist/vue.runtime.esm-bundler.js. If you think Vue should use something else, that would be a package issue with Vue itself to fix, so I would recommend brining it up there.

That said, if Vue are not responsive, or not interested in fixing this configuration, we can create an override for JSPM in https://github.com/jspm/overrides to change how JSPM loads Vue at the JSPM layer.

RemiDesgrange commented 8 months ago

Ok thanks. I think I'll open up a PR in the override repo. There is no way they'll change stuff in Vue :-)

guybedford commented 8 months ago

@RemiDesgrange sure, if you want help putting together the appropriate override just let me know.

guybedford commented 8 months ago

This has been resolved by the override in the above PR.