Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After 'npm install @jspm/generator' the package doesnt work #362

Open
chriswang- opened this issue Jul 6, 2024 · 1 comment
Open

After 'npm install @jspm/generator' the package doesnt work #362

chriswang- opened this issue Jul 6, 2024 · 1 comment

Comments

@chriswang-
Copy link

After adding the package of jspm gnenerator, the package can not work, the error show me , I am working in browser enviroment.

Error while transforming node_modules@jspm\generator\dist\generator.js: Could not resolve import "process".

2 | import '#fetch';
3 | import '@jspm/import-map';

4 | import 'process';
| ^
5 | import 'sver';
6 | import 'sver/convert-range.js';
7 | import 'es-module-lexer/js';

@guybedford
Copy link
Member

You can use an import map to make it work in the browser:

npm install -g jspm
cat '<!doctype html><script type="module">import * as generator from '@jspm/generator'; console.log(generator)</script>' > test.html
jspm install -m test.html @jspm/generator
npx http-server -c-1

Then navigate to localhost:8080/test.html and you should see the generator loading correctly.

Alternatively, just build it with a tool like esbuild first, with or without CDN externals as desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants