Andrew Mykhailiuk
Works in @Snap Inc.
Twitter: @andreyctkn
Github: @andreyutka
Извините, мне нужно собрать фронтенд
Why?
- create the build process
- support it!
- new ways?
three states of questions
from your manager
about frontend build process
first state
second state
third state
So how we can be at the first state?
Agenda:
- Webpack aka loaders lifestyle
- Rollup with plugins
- CLI
- Try to decompose your build
- build process as a tool
Build process:
- copy assets
- compile from X-JS to ES5
- make bundle
- compile styles
- minifying
- style guide
- testing
tl;dr testing
tl;dr style guide
Webpack 1.X
x-tool
x-tool-loader or x-tool-awesome-loader
x-tool-plugin or ...
webpack
babel-loader
readme: Troubleshooting
- babel-loader is slow!
- babel is injecting helpers into each file and bloating my code!
ts-loader
readme: Faster Builds
- You probably don't want to give up type checking; that's rather the point of
TypeScript. So what you can do is use the fork-ts-checker-webpack-plugin
- If you'd like to make things even faster still (I know, right?) then you might want to
consider using ts-loader with happypack which speeds builds by parallelising work.
awesome-typescript-loader
readme: Performance issues
The world is changing, other solutions are evolving and ATL may
work slower for some workloads. Feel free to try ts-loader with
HappyPack or thread-loader and hard-source-webpack-plugin.
https://github.com/TypeStrong/ts-loader/issues/181
webpack:
- copy assets
- compile from X-JS to ES5
- make bundle
- compile styles
- minifying
rollup: 0.62.0
rollup-plugin-commonjs
rollup-plugin-node-resolve
rollup-plugin-replace
rollup:
- copy assets
- compile from X-JS to ES5
- make bundle
- compile styles
- minifying
CLI
angular cli - webpack..
ember cli - broccoli...
react create app - webpack..
let me decompose your build
- use your compiler as compiler
- use your module bundler as module bundler
Assets?
Styles?
CSS in JS better for build process
but not for project
build process as a tool
Stencil is a compiler that generates Web Components (more
specifically, Custom Elements).
Stencil takes features such as:
- Virtual DOM
- Async rendering (inspired by React Fiber)
- Reactive data-binding
- TypeScript
- JSX
Using Stencil Built Web Components
with other frameworks!
https://stenciljs.com/docs/framework-integration
And…
- try to simplify your build as possible
- use the tools to their maximum extent
- try to avoid third party tools as possible
- take a look at build tools as a tool/compiler, as like
as stencil
Maybe it's the end
but
rollup: 0.62.0
vs
webpack 4.15.1
~250 modules
webpack rollup
time 3.68s 3.85s
size 238 kb 232 kb
Andrew Mykhaliuk - Sorry, I need to make a build for frontend

Andrew Mykhaliuk - Sorry, I need to make a build for frontend