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

Thrown Errors cause re-evaluation #49

Closed
bmeck opened this issue Aug 14, 2017 · 1 comment
Closed

Thrown Errors cause re-evaluation #49

bmeck opened this issue Aug 14, 2017 · 1 comment

Comments

@bmeck
Copy link

bmeck commented Aug 14, 2017

Something we could make clearer in Node spec by explicitly stating we are not using require.cache rather than implying it.

For Web throwing an error at runtime does not remove ESM from the Module Map. The EP does not mention require.cache since it is using its own cache, but we could be clearer that we are not using that & we are matching Web behavior on this.

Will update sometime this week with clearer wording.

// a.mjs
import assert from 'assert';
import('./b').catch(
  err => {
    import('./c').then(
      () => assert.fail('should not re-evaluate same module path')
    )
  }
);
// b.mjs
import './c.mjs';
// c.mjs
// this should *always* throw errors since it only evaluates once
if (!global.ok) {
  global.ok = true;
  throw new Error;
}
@jdalton
Copy link
Member

jdalton commented Aug 15, 2017

Closed by f803d23.
I'll be adding a round of unit tests over the next couple of days to solidify support.

@jdalton jdalton closed this as completed Aug 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

2 participants