Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Precompile scripts #179

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Precompile scripts #179

wants to merge 8 commits into from

Conversation

bilou84
Copy link
Contributor

@bilou84 bilou84 commented Jan 7, 2017

This PR improves exports of games in a couples ways:

  • First, we now export pre compiled scripts rather than doing it on every game start at runtime. We also minify the result of the compilation. The means at runtime we have less files (and an overall smaller script to load) and we don't have the compilation which significantely increase the loading time.
  • Thanks to that first point, we don't need the SupCore.js (0.6MB) bundle and the various typescriptAPI.js bundles anymore. I also took the opportunity to minify the SupEngine.js bundle as it was the largest file remaining (from 1MB to 0.5MB). Those point significantely reduces the size of the build.

After testing it on a couple games, I average about 5MB less on the build size which is quite good!
I didn't run the numbers myself on the loading times, but spencer gave it a try and the results are quite nice as well! https://twitter.com/StuffBySpencer/status/815027274319859712

There is one downside though. We are breaking the compatibility with third party plugins.
There is two small things to change when exposing some scripts API (which is the most common thing plugins do of course...):

It would be nice if we could get in touch with developpers to update their plugins before we release the next version. Since it's very easy to fix, hopefully we can get everyeone!

Copy link

@kyxap kyxap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small code style upd requested ;)

},
"devDependencies": {
"@types/convert-source-map": "0.0.30",
"@types/uglify-js": "^2.6.28"
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty line at the end off the file is missed.

return tsResult.js.pipe(gulp.dest("./"));
});

// All
Copy link

@kyxap kyxap Sep 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// All Is not clear comment :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants