standard-things / esm

Tomorrow's ECMAScript modules today!
Other
5.26k stars 146 forks source link

esm seems to pre-load modules despite their order #819

Closed vdeturckheim closed 5 years ago

vdeturckheim commented 5 years ago

Hello there,

If I have a simple module with the following,

import 'sqreen';
import 'express';

sqreen (that needs to be required before express) will see that express is already loaded when it starts (it is already present in require.cache). This happens with esm@3 and was not present in esm@2. Is there any special way to ensure the module is loaded before all other ones?

jdalton commented 5 years ago

Hi @vdeturckheim!

Because of how sqreen works you'll want to load it before after esm. See the our scenario test here.

Update

Fixed typo above

vdeturckheim commented 5 years ago

Hey @jdalton thanks for the answer, I might have been confused by the README that I understand recommend to load esm after Sqreen (https://github.com/standard-things/esm#loading) right?

jdalton commented 5 years ago

Do as my code, not as my comment 🙃