Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

In prepareValue, guard debug check against null property access #752

Closed

Conversation

mk-pmb
Copy link
Contributor

@mk-pmb mk-pmb commented Mar 15, 2019

Fixes #748

It probably just masks the real problem, whatever that might be. For now this makes nodemjs work again, you can still add better tracing later.

Considering how often you use Loader.state.package.default.options.debug, it might be worth a guarding helper function.

@mk-pmb mk-pmb force-pushed the preparevalue-guard-null-options branch from 7a06252 to 1e8397f Compare March 15, 2019 03:37
@mk-pmb mk-pmb changed the title prepareValue: Guard debug mode check against null property access In prepareValue, guard debug check against null property access Mar 15, 2019
@jdalton
Copy link
Member

jdalton commented Mar 15, 2019

Thank you @mk-pmb!

Yes, Loader.state.package.default should be set by then. Are you using esm through node -r esm or through require("esm")(module)?

@mk-pmb
Copy link
Contributor Author

mk-pmb commented Mar 15, 2019

@jdalton
Copy link
Member

jdalton commented Mar 15, 2019

Great! I think I've spotted the issue. I'll prepare build of esm/esm/loader.js for you to swap out.

Update:

Okay! You can either build from our master branch or use loader.js.zip.

@mk-pmb
Copy link
Contributor Author

mk-pmb commented Mar 15, 2019

Looks like no. :-(
I switched to 3.2.12 and replaced /home/ci-test/lib/node_modules/esm/esm/loader.js with your new one (SHA-1 099c30ebf88f4506bd7da17eafa6bea7f6d414c3): still fails with Cannot read property 'options' of null.
Then I built from master (c07d4ad), same result.

I'll try and extend the esmod-pmb test so you can test it automatically.

@jdalton
Copy link
Member

jdalton commented Mar 15, 2019

Hmm OK. I'll add the guard then.

Update:

Can you try from our master branch again? You'll have to force update since I force pushed.

@jdalton jdalton closed this in 062e1b8 Mar 15, 2019
@jdalton jdalton added the bug label Mar 15, 2019
@mk-pmb
Copy link
Contributor Author

mk-pmb commented Mar 15, 2019

Works with current master. 👍

@jdalton
Copy link
Member

jdalton commented Mar 15, 2019

esm v3.2.18 is released 🎉

@mk-pmb mk-pmb deleted the preparevalue-guard-null-options branch March 15, 2019 21:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

2 participants