Repository navigation
fix: bundle entry points - #8884
Merged
Merged
Conversation
# Conflicts: # packages/core/globals/index.ts
Contributor
|
I think we did some tests with import vs. require and were seeing exactly what is commented on that thread here: Where using require as opposed to import seemed to be guarantee. |
Collaborator
Author
|
Imports will all get at the top you are right. Which is why I changed the way initGlobals is called to ensure the right order. |
Collaborator
Author
|
After that test with that code and you ll see the order being correct. |
Member
rigor789
approved these changes
Sep 23, 2020
Contributor
|
Awesome thanks @farfromrefug and @rigor789 👍 |
Contributor
|
Released with 7.0.5 https://github.com/NativeScript/NativeScript/releases/tag/7.0.5-core |
Collaborator
Author
|
@NathanWalker i think it needs a webpack release too. #8778 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

As requested here is the PR again which fixes
This PR fixes a big issue which appeared with N 7 / esm / webpack
With webpack import / require order is not respected : webpack/webpack#1343
Now in bundle-config-loader we rely on
requireto loadbundle-entry-pointsthus callinginitGlobalsand making tslib functions global.Because it uses
requireit actually end up at the end of yourmain.js(simply look at a generated bundle.js)To keep that call up we need to use
importBut that is not enough!
in
bundle-entry-pointswe use 'require' on 'globals'. And usingimportis not enough either because we call a method on it which will end up after all imports!The solution to all this is call
initGlobalinsideglobal/index.tsthen useimport './global'for example.Doing that i needed cleanup a bit and we end up with only on use of
initGlobalEDIT: that app will crash on ios because of that. The reason is that i import View at the top of my main.ts which include files using
__metadata