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

Use Rollup #4301

Merged
merged 36 commits into from
May 25, 2017
Merged

Use Rollup #4301

merged 36 commits into from
May 25, 2017

Conversation

gkatsev
Copy link
Member

@gkatsev gkatsev commented Apr 21, 2017

Based partially on https://github.com/videojs/video.js/compare/master...Rich-Harris:rollup?expand=1
Currently, exports UMD, minified UMD, CJS, and ES rolluped files as well as equivalent formats for the novtt file.
Still needs to be updated to work with the tests, which could be an issue, potentially, because of proxyquireify. Maybe tests will stay as they are.

The build is currently failing because the only babelrc is told to not compile module syntax and that is causing grunt and things to fail.

@gkatsev
Copy link
Member Author

gkatsev commented Apr 21, 2017

Here's the assets output:

┌───────────────────────────────┬───────────┬───────────┐
│ filename                      │      size │   gzipped │
├───────────────────────────────┼───────────┼───────────┤
│ alt/video-js-cdn.css          │  53.12 KB │  13.99 KB │
├───────────────────────────────┼───────────┼───────────┤
│ alt/video-js-cdn.min.css      │   45.6 KB │  13.69 KB │
├───────────────────────────────┼───────────┼───────────┤
│ alt/video.novtt.js            │ 796.66 KB │ 151.63 KB │
├───────────────────────────────┼───────────┼───────────┤
│ alt/video.novtt.min.js        │ 226.18 KB │  47.63 KB │
├───────────────────────────────┼───────────┼───────────┤
│ alt/video.novtt.rollup.cjs.js │  604.6 KB │ 134.85 KB │
├───────────────────────────────┼───────────┼───────────┤
│ alt/video.novtt.rollup.es.js  │ 604.58 KB │ 134.84 KB │
├───────────────────────────────┼───────────┼───────────┤
│ alt/video.novtt.rollup.js     │ 604.83 KB │ 134.93 KB │
├───────────────────────────────┼───────────┼───────────┤
│ alt/video.novtt.rollup.min.js │ 156.56 KB │  40.42 KB │
├───────────────────────────────┼───────────┼───────────┤
│ video-js.css                  │  53.31 KB │     14 KB │
├───────────────────────────────┼───────────┼───────────┤
│ video-js.min.css              │  45.74 KB │  13.69 KB │
├───────────────────────────────┼───────────┼───────────┤
│ video-js.swf                  │  16.72 KB │  16.74 KB │
├───────────────────────────────┼───────────┼───────────┤
│ video.js                      │ 853.01 KB │ 165.83 KB │
├───────────────────────────────┼───────────┼───────────┤
│ video.min.js                  │ 245.82 KB │  53.97 KB │
├───────────────────────────────┼───────────┼───────────┤
│ video.rollup.cjs.js           │  732.1 KB │ 154.19 KB │
├───────────────────────────────┼───────────┼───────────┤
│ video.rollup.es.js            │ 732.08 KB │ 154.18 KB │
├───────────────────────────────┼───────────┼───────────┤
│ video.rollup.js               │ 732.33 KB │ 154.26 KB │
├───────────────────────────────┼───────────┼───────────┤
│ video.rollup.min.js           │ 213.41 KB │  49.48 KB │
└───────────────────────────────┴───────────┴───────────┘

all the files that rollup currently generates have rollup in the name and generally correspond to the same files that don't have rollup.

One thing I just realized is that the cjs builds shouldn't be running with node-resolve and commonjs plugins so bundlers will pick those up. The ES one should potentially do that as well.

@gkatsev
Copy link
Member Author

gkatsev commented Apr 27, 2017

Will require this change in vttjs: videojs/vtt.js#14

build/rollup.js Outdated

minifiedUmd.options.plugins.splice(4, 0, uglify({
preserveComments: 'some',
srewIE8: false,
Copy link
Member

Choose a reason for hiding this comment

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

Appears to be a typo.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup.

@@ -128,13 +150,14 @@
"videojs-doc-generator": "0.0.1",
"videojs-flash": "^1.1.0",
"videojs-standard": "^6.0.1",
"webpack": "^2.3.0"
"webpack": "^1.15.0"
Copy link
Member Author

Choose a reason for hiding this comment

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

webpack 2 doesn't support IE8: webpack/webpack#3070

@gkatsev gkatsev changed the title WIP: Use Rollup Use Rollup May 17, 2017
@gkatsev
Copy link
Member Author

gkatsev commented May 17, 2017

I believe this is good to go now. One way to test and verify this is to clone this branch, npm install and run npm run build. Then, clone videojs-bundler-sample and in it run npm install /path/to/videojs followed by npm start. Then, if you go to the index page in the bundler repo in the browser, you'll be able to see it with all the various types of bundlers. Doing npm install with a path over linking is necessary because otherwise babel ends up breaking for some of the builds.

@gkatsev gkatsev dismissed misteroneill’s stale review May 17, 2017 20:58

Updated and needs a re-review and test

@gkatsev
Copy link
Member Author

gkatsev commented May 17, 2017

The current output of the assets script:

┌──────────────────────────┬───────────┬───────────┐
│ filename                 │      size │   gzipped │
├──────────────────────────┼───────────┼───────────┤
│ alt/video-js-cdn.css     │  53.12 KB │  13.98 KB │
├──────────────────────────┼───────────┼───────────┤
│ alt/video-js-cdn.min.css │   45.6 KB │  13.69 KB │
├──────────────────────────┼───────────┼───────────┤
│ alt/video.novtt.js       │ 611.79 KB │ 136.34 KB │
├──────────────────────────┼───────────┼───────────┤
│ alt/video.novtt.min.js   │ 158.16 KB │  40.79 KB │
├──────────────────────────┼───────────┼───────────┤
│ video-js.css             │  53.31 KB │     14 KB │
├──────────────────────────┼───────────┼───────────┤
│ video-js.min.css         │  45.74 KB │  13.69 KB │
├──────────────────────────┼───────────┼───────────┤
│ video-js.swf             │  16.91 KB │  16.93 KB │
├──────────────────────────┼───────────┼───────────┤
│ video.cjs.js             │ 600.68 KB │ 133.11 KB │
├──────────────────────────┼───────────┼───────────┤
│ video.es.js              │ 600.43 KB │ 133.05 KB │
├──────────────────────────┼───────────┼───────────┤
│ video.js                 │ 664.96 KB │ 150.79 KB │
├──────────────────────────┼───────────┼───────────┤
│ video.min.js             │ 177.58 KB │  47.35 KB │
└──────────────────────────┴───────────┴───────────┘

@gkatsev
Copy link
Member Author

gkatsev commented May 17, 2017

Here's a merged table:

┌──────────────────────────┬─────────────────┬─────────────┬────────────────────┬────────────────┐
│ filename                 │ size browserify │ size rollup │ gzipped browserify │ gzipped rollup │
├──────────────────────────┼─────────────────┼─────────────┼────────────────────┼────────────────┤
│ alt/video-js-cdn.css     │        53.12 KB │    53.12 KB │           13.99 KB │       13.98 KB │
├──────────────────────────┼─────────────────┼─────────────┼────────────────────┼────────────────┤
│ alt/video-js-cdn.min.css │         45.6 KB │     45.6 KB │           13.69 KB │       13.69 KB │
├──────────────────────────┼─────────────────┼─────────────┼────────────────────┼────────────────┤
│ alt/video.novtt.js       │       796.66 KB │   611.79 KB │          151.63 KB │      136.34 KB │
├──────────────────────────┼─────────────────┼─────────────┼────────────────────┼────────────────┤
│ alt/video.novtt.min.js   │       226.18 KB │   158.16 KB │           47.63 KB │       40.79 KB │
├──────────────────────────┼─────────────────┤─────────────┼────────────────────┼────────────────┤
│ video-js.css             │        53.31 KB │    53.31 KB │              14 KB │          14 KB │
├──────────────────────────┼─────────────────┤─────────────┼────────────────────┼────────────────┤
│ video-js.min.css         │        45.74 KB │    45.74 KB │           13.69 KB │       13.69 KB │
├──────────────────────────┼─────────────────┤─────────────┼────────────────────┼────────────────┤
│ video-js.swf             │        16.72 KB │    16.91 KB │           16.74 KB │       16.93 KB │
├──────────────────────────┼─────────────────┤─────────────┼────────────────────┼────────────────┤
│ video.cjs.js             │ N/A             │   600.68 KB │ N/A                │      133.11 KB │
├──────────────────────────┼─────────────────┼─────────────┼────────────────────┼────────────────┤
│ video.es.js              │ N/A             │   600.43 KB │ N/A                │      133.05 KB │
├──────────────────────────┼─────────────────┼─────────────┼────────────────────┼────────────────┤
│ video.js                 │       853.01 KB │   664.96 KB │          165.83 KB │      150.79 KB │
├──────────────────────────┼─────────────────┤─────────────┼────────────────────┼────────────────┤
│ video.min.js             │       245.82 KB │   177.58 KB │           53.97 KB │       47.35 KB │
└──────────────────────────┴─────────────────┴─────────────┴────────────────────┴────────────────┘

Copy link
Member

@misteroneill misteroneill 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. Works fine. I had one tiny comment/suggestion. Do with it what you will.

build/rollup.js Outdated
}
if (warning.code === 'UNRESOLVED_IMPORT') {
return;
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe these two blocks should be combined.

@gkatsev gkatsev merged commit c31836c into master May 25, 2017
@gkatsev gkatsev deleted the rollup branch May 25, 2017 23:47
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.

2 participants