jspm / generator

JSPM Import Map Generator
Apache License 2.0
165 stars 21 forks source link

Incorrect import version added to import map #175

Closed zachsa closed 2 years ago

zachsa commented 2 years ago

Using version 1.0.0-beta.36:

package.json has this dependency: "graphql": "^16.6". But running the generator I get an older version added as an import to the import map: "graphql": "https://ga.jspm.io/npm:graphql@16.5.0/index.mjs",

Would it be possible for the generator to throw an error if it isn't able to resolve versions as specified in package.lock or package-lock.json?

The code I'm using is this:

const generator = new Generator({
  mapUrl: pathToFileURL(TARGET),
  env: ['browser', NODE_ENV, 'module'],
  defaultProvider: 'jspm',
})

const htmlSource = await readFile('source.html', 'utf-8')
const pins = await generator.addMappings(htmlSource)
const html = await generator.htmlInject(htmlSource, {
  trace: true,
  pins,
  preload: false,
  integrity: false,
  esModuleShims: true,
})
guybedford commented 2 years ago

GraphQL 16.6.0 had not been built yet, I've triggered a build and it should be working now. You can check the latest version via https://ga.jspm.io/npm:graphql.

guybedford commented 2 years ago

Note that you can also trigger missing builds via the rebuild API.