jspm / generator

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

import for node:process included in import map #121

Closed zachsa closed 2 years ago

zachsa commented 2 years ago

Hi Guy,

Thank you for being so responsive in assisting with setting up / debugging using Node import maps. As you mentioned - the node:process import specifier (is that the correct term here?) is an error. This issue is just to keep track of it

Import map (with module flag)

{
  "scopes": {
    "./": {
      "react": "https://ga.jspm.io/npm:react@18.0.0/dev.index.js",
      "react-dom/client": "https://ga.jspm.io/npm:react-dom@18.0.0/dev.client.js",
      "react/jsx-runtime": "https://ga.jspm.io/npm:react@18.0.0/dev.jsx-runtime.js"
    },
    "https://ga.jspm.io/": {
      "node:process": "https://ga.jspm.io/npm:@jspm/core@2.0.0-beta.24/nodelibs/node/process.js",
      "process": "https://ga.jspm.io/npm:@jspm/core@2.0.0-beta.24/nodelibs/node/process.js",
      "react": "https://ga.jspm.io/npm:react@18.0.0/dev.index.js",
      "react-dom": "https://ga.jspm.io/npm:react-dom@18.0.0/dev.index.js",
      "scheduler": "https://ga.jspm.io/npm:scheduler@0.21.0/dev.index.js"
    }
  }
}

Import map (without module flag)

{
  "scopes": {
    "./": {
      "react": "https://ga.jspm.io/npm:react@18.0.0/dev.index.js",
      "react-dom/client": "https://ga.jspm.io/npm:react-dom@18.0.0/dev.client.js",
      "react/jsx-runtime": "https://ga.jspm.io/npm:react@18.0.0/dev.jsx-runtime.js"
    },
    "https://ga.jspm.io/": {
      "node:process": "https://ga.jspm.io/npm:@jspm/core@2.0.0-beta.24/nodelibs/node/process.js",
      "process": "https://ga.jspm.io/npm:@jspm/core@2.0.0-beta.24/nodelibs/node/process.js",
      "react": "https://ga.jspm.io/npm:react@18.0.0/dev.index.js",
      "react-dom": "https://ga.jspm.io/npm:react-dom@18.0.0/dev.index.js",
      "scheduler": "https://ga.jspm.io/npm:scheduler@0.21.0/dev.index.js"
    }
  }
}

(I included output from generating import maps with/without the module flag just in case that is important - but the import maps look the same to me)

zachsa commented 2 years ago

Having just experimented further (https://github.com/jspm/generator/issues/122) I can see that there are other node standard library modules that this applies to:

node:buffer, node:process, node:stream

zachsa commented 2 years ago

Now I see that all Node.js standard library imports do not work (is standard library the correct term). I would like to use an import map for all node imports - is this going to be supported?

zachsa commented 2 years ago

(or alternatively, generating an import map for node.js should omit all standard imports)

guybedford commented 2 years ago

I can confirm this is a bug.

guybedford commented 2 years ago

Fixed in https://github.com/jspm/generator/pull/126.