-
Notifications
You must be signed in to change notification settings - Fork 5
Chore: replace Rollup.js bundler with Webpack #128
Conversation
- This initial Webpack refactor patch aims for parity with the previous Rollup.js implementation. The configuration was largely derived from project Marvin. There are many enhancements possible with the new configuration but an effort to keep changes minimal where practical was made. For example, subsequent patches may diversify the library entry points offered, automatically vendor prefix all CSS, or inline image assets as data URIs. https://phabricator.wikimedia.org/source/marvin/browse/master/ - The unusual Rollup.js Babel configuration is simplified and consolidated at the project root. - An empty PostCSS configuration is included for later auto-vendor prefixing. - The JavaScript and CSS artifacts have been minimized in production builds. Notably, the JavaScript build product is now half what it was. - A superfluous entry, build/wikimedia-page-library-override.js, is now generated and may safely be ignored. This is noted in the readme. webpack-contrib/extract-text-webpack-plugin#518 - All demo URLs have been updated to reference webpack-dev-server outputs. - There are no anticipated client changes necessary but integrators should smoke test CSS and JavaScript functionality, especially on older devices. - The NPM clean script has been removed as this is part of the build process provided by Webpack and the "Clean for WebPack" plugin. - The build:watch NPM script is preserved to retain existing app developer workflows. App devs should verify that their processes are unaltered.
@montehurd, I believe that concatenation order is based on import order (starting with the entry point, src/transform/index.js in our usage). In any case, I think the only spot this mattered was for the theme transform CSS and if you run |
@montehurd let me me know if you want to walk through these changes on Hangouts or if some other work is wanted 👍 I'm eager to get this in! |
@niedzielski oh a hangout would be great! sorry about the CR delay - got pulled into reading lists native bits for a while :) |
readme.md
Outdated
@@ -21,8 +21,11 @@ Presently we are consolidating duplicate Android and iOS Wikipedia app implement | |||
### What wikimedia-page-library delivers | |||
- **wikimedia-page-library-transform.js** bundle of all transform JS | |||
- **wikimedia-page-library-transform.css** bundle of all CSS required by the bundled transform JS | |||
- **wikimedia-page-library-transform.js** an unwanted [extraneous build product] that may safely be ignored |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename this guy.
The apps want to use their own minifiers for the time being. Remove the minified build products until they're wanted.
@montehurd feedback addressed and ready for review. |
I gave this a quick integration tire-kicking this morning and had one issue... I made a change to a css file and JS file and ran "npm run-script build", but didn't see
Opps needed to run |
@montehurd, this appears to work correctly for me locally:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Been hammering this for a while and re-testing all transforms... so far seem solid! :)
Noticed on `enwiki > Javascript`. The collapsed tables borders were gone when using sepia or dark themes. Caused by using the '-p' webpack switch, which caused the CSS to be minified ( webpack-contrib/html-loader#65 (comment) ), which changed the order of CSS, which was important. Specifically, the `ThemeTransform` CSS needs to be 1st, as outlined here https://github.com/wikimedia/wikimedia-page-library/blob/master/src/transform/index.js#L3 and here #128 (comment)
This initial Webpack refactor patch aims for parity with the previous
Rollup.js implementation. The configuration was largely derived from
project Marvin. There are many enhancements possible with the new
configuration but an effort to keep changes minimal where practical
was made. For example, subsequent patches may diversify the library
entry points offered, automatically vendor prefix all CSS, or inline
image assets as data URIs.
https://phabricator.wikimedia.org/source/marvin/browse/master/
The unusual Rollup.js Babel configuration is simplified and
consolidated at the project root.
An empty PostCSS configuration is included for later auto-vendor
prefixing.
The JavaScript and CSS artifacts have been minimized in production
builds. Notably, the JavaScript build product is now half what it was.
A superfluous entry, build/wikimedia-page-library-override.js, is now
generated and may safely be ignored. This is noted in the readme.
Entry chunks for .css files also creating .js files webpack-contrib/extract-text-webpack-plugin#518
All demo URLs have been updated to reference webpack-dev-server
outputs.
There are no anticipated client changes necessary but integrators
should smoke test CSS and JavaScript functionality, especially on
older devices.
The NPM clean script has been removed as this is part of the build
process provided by Webpack and the "Clean for WebPack" plugin.
The build:watch NPM script is preserved to retain existing app
developer workflows. App devs should verify that their processes are
unaltered.