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

Uncaught TypeError: global is undefined #21

Closed
raboof opened this issue Nov 25, 2021 · 2 comments
Closed

Uncaught TypeError: global is undefined #21

raboof opened this issue Nov 25, 2021 · 2 comments

Comments

@raboof
Copy link
Contributor

raboof commented Nov 25, 2021

When I check out the project, npm install, npm run start and open the sample in the browser (tried both Firefox and Chromium), I don't get a functional sample:

peri

And in the javascript console:

Uncaught TypeError: global is undefined
    parcelRequire<["node_modules/node-libs-browser/node_modules/buffer/index.js"]< index.js:43
    newRequire src.f10117fe.js:47
    localRequire src.f10117fe.js:53
    parcelRequire<["node_modules/lodash/lodash.js"]< src.f10117fe.js:2377
    newRequire src.f10117fe.js:47
    localRequire src.f10117fe.js:53
    parcelRequire<["src/micromerge.ts"]< micromerge.ts:3
    newRequire src.f10117fe.js:47
    localRequire src.f10117fe.js:53
    parcelRequire<["src/bridge.ts"]< bridge.ts:5
    newRequire src.f10117fe.js:47
    localRequire src.f10117fe.js:53
    parcelRequire<["src/index.ts"]< index.ts:1
    newRequire src.f10117fe.js:47
    parcelRequire src.f10117fe.js:81
    <anonymous> src.f10117fe.js:120

npm run test is fine, node v14.18.1, npm 6.14.15

the global seems to have been removed from buffer between 4.x and 5.0 (in feross/buffer@8746070#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346R41), but node-libs-browser is still on 4.x and not interested in updating.

joelewis added a commit to joelewis/peritext that referenced this issue Nov 27, 2021
Parcel has some [misunderstandings between script tags declared as es module](parcel-bundler/parcel#1401) and it's cascading into the build as console errors inkandswitch#22  inkandswitch#21 

Removing the attribute sorts this out. until they fix it in Parcel.
@geoffreylitt
Copy link
Collaborator

Thanks for the bug report!

Can you try pulling latest main and see if that fixes it? I tried a change to our parcel dependency which may be related: eef2525

@raboof
Copy link
Contributor Author

raboof commented Nov 27, 2021

That seems to have done the trick, thanks!

(I had to explicitly npm install parcel for the parcel command to become available - that might be something to mention in the README?)

@raboof raboof closed this as completed Nov 27, 2021
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