-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: bundle entry points #8884
fix: bundle entry points #8884
Conversation
# Conflicts: # packages/core/globals/index.ts
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. |
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. |
After that test with that code and you ll see the order being correct. |
Awesome thanks @farfromrefug and @rigor789 👍 |
Released with 7.0.5 https://github.com/NativeScript/NativeScript/releases/tag/7.0.5-core |
@NathanWalker i think it needs a webpack release too. #8778 |
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
require
to loadbundle-entry-points
thus callinginitGlobals
and making tslib functions global.Because it uses
require
it 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
import
But that is not enough!
in
bundle-entry-points
we use 'require' on 'globals'. And usingimport
is not enough either because we call a method on it which will end up after all imports!The solution to all this is call
initGlobal
insideglobal/index.ts
then useimport './global'
for example.Doing that i needed cleanup a bit and we end up with only on use of
initGlobal
EDIT: 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