fix pkg module reference to original entry #568
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@stefanpenner I had a very weird silent build bug when I tried to run
router_js
with my emberx experiment: https://github.com/izelnakri/emberx/tree/rsvp-fail . The tests were failing with bothesbuild
andtsc
outputs, after some in-depth investigation I found that this reference is causing the problem. I fixed it in this commit, and tests started passing(you can ignore the Dockerfile change): izelnakri/emberx@5312bf2What is happening?
This library has not been published for 2 years, mainly I suppose there was no need for it. It has 0 dependencies, however the package itself tries to do some runtime imports and its runtime changes based on that: https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/asap.js#L90
When I change the "module" entry
scheduleFlush
get assigned to different functions betweendist/rsvp.es.js
(original) andlib/rsvp.js
(current fix). Original entry results in runtime error on my specific tests in browser that are built on top ofrouter_js
.This makes
router_js
which depends onrsvp
not runnable correctly on node.js and browser environments until we apply the change in this PR.Steps to reproduce
Clone emberx repo: https://github.com/izelnakri/emberx
Change branch to
rsvp-fail
: https://github.com/izelnakri/emberx/tree/rsvp-failInstall dependencies and run tests:
$ npm install && npm run test
. Tests should fail with runtime error, smt like_state of undefined
Apply this commit: izelnakri/emberx@5312bf2
Run the tests again:
$ npm run test
. Tests should pass now.Although this is a temporary solution, I think we should merge it because the library itself is written in es modules, so module reference shouldn't need a build step, including for ember-cli environments. This removes the extra layer of indirection between the library code and its runtime as we simplfy the library build process for modern bundlers. Transpiling the code with both
esbuild
andtsc
both gives the same runtime error.