Skip to content
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

Update webpack@4.11.1 + Use TypeScript compiler instead of Babel #1762

Merged
merged 15 commits into from Jun 25, 2018
Merged

Update webpack@4.11.1 + Use TypeScript compiler instead of Babel #1762

merged 15 commits into from Jun 25, 2018

Conversation

Korilakkuma
Copy link
Contributor

@Korilakkuma Korilakkuma commented Jun 6, 2018

This PR will...

Updated webpack@4.11.1 and webpack.config.js. Along with it, installed webpack-cli.

Why is this Pull Request needed?

The build is faster than webpack@3.5.5. Therefore, I think CI finishes faster.

Are there any points in the code the reviewer needs to double check?

Resolves issues:

Related PR

#1631

Checklist

  • changes have been done against master branch, and PR does not conflict
  • no commits have been done in dist folder (we will take care of updating it)
  • new unit / functional tests have been added (whenever applicable)
  • API or design changes are documented in API.md

@tchakabam
Copy link
Collaborator

How much faster? :)

Copy link
Collaborator

@tchakabam tchakabam left a comment

Choose a reason for hiding this comment

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

I would still need to test it, but looks good so far 👍

@@ -14,19 +14,6 @@ const addAltAudioSupport = !!env.ALT_AUDIO || !!env.USE_ALT_AUDIO;
const addEMESupport = !!env.EME_DRM || !!env.USE_EME_DRM;
const runAnalyzer = !!env.ANALYZE;

const uglifyJsOptions = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

i like

@tchakabam
Copy link
Collaborator

tchakabam commented Jun 7, 2018

@Korilakkuma Not sure if you knew, but the upgrade to webpack 4.x is already included in the Typescript toolchain PR: #1716

Wouldn't you want to continue this work maybe rather? It would be even a much more great contribution to the project!

@tchakabam
Copy link
Collaborator

@Korilakkuma Also, if you like working on the toolchain, feel free to continue the work on that PR as well :) Or merge all together to one branch! #1631

@Korilakkuma
Copy link
Contributor Author

@tchakabam Thank you for review.

merge all together to one branch!

Namely, I should change the merge destination of this PR to improve-webpack-conf branch (#1631) ?

@tchakabam
Copy link
Collaborator

tchakabam commented Jun 7, 2018

@Korilakkuma Maybe the simplest is I will just close #1631 because in the end it's not really much. If you see anything useful there feel free to merge in that branch into yours here. But then again, it's just making sure the OccurenceOrder plugin is not used in dev. You can just copy-paste that over :) The other stuff is pretty cosmetic.

What would be more interesting to do would be to continue your work on the TypeScript branch (#1716), it already contains the upgrade to Webpack v4 which you have done here :)

This is something really important actually, and it would be great if you would want to pick it up.

package.json Outdated
@@ -52,7 +52,7 @@
"test": "npm run test:unit && npm run test:func",
"test:unit": "karma start karma.conf.js",
"test:unit:watch": "karma start karma.conf.js --auto-watch --no-single-run",
"test:func": "cross-env BABEL_ENV=test mocha --compilers js:babel-register tests/functional/auto/setup.js --timeout 40000"
"test:func": "cross-env BABEL_ENV=test mocha --require ts-node/register tests/functional/auto/setup.js --timeout 40000"
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍 you can probably get rid or rename the BABEL_ENV thing.

We were using ts-node as well in another project for powering the toolchain, as we are writing everything down to the Webpack in Typescript. We were just calling scripts like so: ts-node ./node_modules/.bin/webpack. So that's always still a possibility, just for info.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you can probably get rid or rename the BABEL_ENV thing

👍

Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure what it does or if we need a similar thing in typescript though.

@tchakabam tchakabam changed the title Update webpack@4.11.1 Update webpack@4.11.1 + Use TypeScript compiler instead of Babel Jun 8, 2018
@tchakabam
Copy link
Collaborator

Cool. Might be ready to merge ... :)

Copy link
Collaborator

@azu azu left a comment

Choose a reason for hiding this comment

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

LGTM

package.json Outdated
@@ -51,21 +52,16 @@
"test": "npm run test:unit && npm run test:func",
"test:unit": "karma start karma.conf.js",
"test:unit:watch": "karma start karma.conf.js --auto-watch --no-single-run",
"test:func": "cross-env BABEL_ENV=test mocha --compilers js:babel-register tests/functional/auto/setup.js --timeout 40000"
"test:func": "cross-env mocha --require ts-node/register tests/functional/auto/setup.js --timeout 40000"
Copy link
Collaborator

@azu azu Jun 9, 2018

Choose a reason for hiding this comment

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

Can you removecross-env?
Because, it does not set env.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. I try to remove cross-env 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed cross-env.

@Korilakkuma
Copy link
Contributor Author

@azu @tchakabam

I removed cross-env. And, I added mode to karma.conf.js in order to correspond to webpack@4.11.1. So, please review again.

}

return [enabledConfig, demoConfig];
console.log(
`Building Hls.js with webpack config:\n\n${JSON.stringify(configs, null, 4)}\n`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe even better: console.log(Building configs: ${configs.map(config => config.name).join(', ')}.\n);

This will just display the names of all the configs being built :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

tsconfig.json Outdated
{
"compilerOptions": {
//"inlineSourceMap": true,
"sourceMap": true,
Copy link
Collaborator

Choose a reason for hiding this comment

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

are source-maps working correctly?

are they pointing straight into the js file, or into the tsc compiler output? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The source maps are created as external file.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, that's good. But are they "working" ? I mean by that, are you able to debug the demo for example, and map a breakpoint into the original source-files? for example :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

admitted, i could check this myself, but just asking ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry. It seems that source map is working.

hlsjs-source-map

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And I can map a breakpoint into the original source-files.

hlsjs-breakpoint

Copy link
Collaborator

Choose a reason for hiding this comment

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

awesome 👍

Copy link
Member

Choose a reason for hiding this comment

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

noUnusedLocals and noUnusedParameters might be good options to add

@tchakabam
Copy link
Collaborator

Very cool, just a few details to verifiy 👍

@tchakabam tchakabam self-requested a review June 11, 2018 14:07
@tchakabam
Copy link
Collaborator

@tjenkinson Do you see anything else tbd? :)

Copy link
Member

@tjenkinson tjenkinson left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@tchakabam
Copy link
Collaborator

OK. This should be good. But before we merge, I guess we should just validate this on IE11 "just to be sure". If I have well understood what Babel was doing, and what tsc should be doing, this should be fine. However, chances are that we haven't completely gotten it, and that we are still using some thingie that Babel was inserting a polyfill for and IE11 doesn't support natively. Even if our assumption is currently that Babel (in our current configuration) wasn't polyfilling anything, but only transforming ES6 constructs into ES5. So let's better make sure. And then merge + enjoy :)

@tchakabam
Copy link
Collaborator

IE ✅

@tchakabam tchakabam modified the milestones: 1.0.0, 0.10.0, 0.10.1 Jun 13, 2018
@tchakabam
Copy link
Collaborator

@Korilakkuma Very last thing: the package-lock file should be different, probably as you set karma to v3 again, you should have an unstaged change there as well after an install. Can you re-run npm install just to make sure, and commit it again?

@Korilakkuma
Copy link
Contributor Author

@tchakabam

I tried above procedure. But package-lock.json is not difference to pushed.

@tchakabam
Copy link
Collaborator

tchakabam commented Jun 13, 2018

@Korilakkuma Thanks for checking this out 👍 This probably makes sense. Sorry I had you do this first, but I just checked what the diff on the package-lock actually is here for me, and I got this:

diff --git a/package-lock.json b/package-lock.json
index 6ce8a099..bb47af9a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1194,7 +1194,7 @@
     },
     "buffer": {
       "version": "4.9.1",
-      "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz",
+      "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz",
       "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=",
       "dev": true,
       "requires": {
@@ -5914,7 +5914,7 @@
     },
     "ip": {
       "version": "1.1.5",
-      "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
+      "resolved": "http://registry.npmjs.org/ip/-/ip-1.1.5.tgz",
       "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=",
       "dev": true
     },
@@ -10729,7 +10729,7 @@
     },
     "through2": {
       "version": "1.1.1",
-      "resolved": "https://registry.npmjs.org/through2/-/through2-1.1.1.tgz",
+      "resolved": "http://registry.npmjs.org/through2/-/through2-1.1.1.tgz",
       "integrity": "sha1-CEfLxESfNAVXTb3M2buEG4OsNUU=",
       "dev": true,
       "requires": {
@@ -11257,7 +11257,7 @@
     },
     "tty-browserify": {
       "version": "0.0.0",
-      "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
+      "resolved": "http://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
       "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=",
       "dev": true
     },

No idea why these few assets get resolved through http rather than https on my system :D But it's definitely not an actual issue.

@tchakabam
Copy link
Collaborator

⚠️ This will get merged to master right after we released 0.10.0, which should probably happen soon 👍

@tchakabam tchakabam modified the milestones: 0.10.1, 0.10.2 Jun 13, 2018
@tchakabam
Copy link
Collaborator

tchakabam commented Jun 14, 2018

Before we merge this we could/should:

  • adapt the readme to mention TS (mentioning Babel currently)
  • add the esdoc plugin for typescript so that we get API docs generated based on type-declarations
  • add necessary eslint config for typescript (plugin etc)

@tchakabam
Copy link
Collaborator

@Korilakkuma we would like to merge this soon, but with the todos above (so that we can seemlessly move on with converting components to TS). therefore, i would merge this here into a typescript branch on our repo, and then quickly add the remaining things, and merge everything to master, finally.

@Korilakkuma Korilakkuma changed the base branch from master to replace-babel-by-typescript June 19, 2018 12:42
@Korilakkuma
Copy link
Contributor Author

@tchakabam

I changed master to replace-babel-by-typescript. Is this correct ?

@tchakabam
Copy link
Collaborator

@Korilakkuma Thanks!

@tchakabam tchakabam changed the base branch from replace-babel-by-typescript to typescript-finalize June 25, 2018 10:28
@tchakabam tchakabam merged commit 44efa98 into video-dev:typescript-finalize Jun 25, 2018
@tchakabam tchakabam mentioned this pull request Jun 25, 2018
4 tasks
@tchakabam
Copy link
Collaborator

@Korilakkuma @tjenkinson @azu -> #1800

@Korilakkuma Korilakkuma deleted the feature/update-webpack branch August 15, 2018 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants