All Projects → blacksonic → Typescript Webpack Tree Shaking

blacksonic / Typescript Webpack Tree Shaking

Tree-shaking example with Typescript and Webpack

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Typescript Webpack Tree Shaking

Webpack Common Shake
CommonJS Tree Shaker plugin for WebPack
Stars: ✭ 875 (+507.64%)
Mutual labels:  webpack, tree-shaking
Babel Webpack Tree Shaking
Tree-shaking example with Babel and Webpack
Stars: ✭ 254 (+76.39%)
Mutual labels:  webpack, tree-shaking
React Dynamic Route Loading Es6
Auto chunking and dynamic loading of routes with React Router and Webpack 2
Stars: ✭ 297 (+106.25%)
Mutual labels:  webpack, tree-shaking
That React App You Want
That react app you always wanted: [email protected], [email protected], postCSS, purifycss, dll's and code splitting examples, bregh. Highly opinionated but you better like it.
Stars: ✭ 27 (-81.25%)
Mutual labels:  webpack, tree-shaking
Budgeting
Budgeting - React + Redux + Webpack (tree shaking) Sample App
Stars: ✭ 971 (+574.31%)
Mutual labels:  webpack, tree-shaking
Webpack Core Usage
webpack2完整系列课程,欢迎阅读。同时欢迎移步我的react全家桶文章全集: https://github.com/liangklfangl/react-article-bucket
Stars: ✭ 94 (-34.72%)
Mutual labels:  webpack, tree-shaking
Serverless Plugin Webpack
Serverless Plugin Webpack
Stars: ✭ 72 (-50%)
Mutual labels:  webpack, tree-shaking
Awesome Bundle Size
📝 An awesome list of tools and techniques to make your web bundle size smaller and your web apps load faster.
Stars: ✭ 118 (-18.06%)
Mutual labels:  webpack, tree-shaking
X0
Document & develop React components without breaking a sweat
Stars: ✭ 1,706 (+1084.72%)
Mutual labels:  webpack
Vue3 Bigdata
一个基于vue3.0的大数据分析系统,包含各种echarts和vue3.0新API
Stars: ✭ 139 (-3.47%)
Mutual labels:  webpack
Eleventy Starter Boilerplate
🚀 Eleventy Starter is production-ready with SEO-friendly for quickly starting a blog. ⚡ Built with Eleventy, ESLint, Prettier, Webpack, PostCSS, Tailwind CSS and Netlify CMS (optional).
Stars: ✭ 139 (-3.47%)
Mutual labels:  webpack
Create React Server
Server & middleware for React + Router + Redux with Server Side Rendering
Stars: ✭ 139 (-3.47%)
Mutual labels:  webpack
Vue 2 Webpack 4 Boilerplate
Ready to use Vue 2+ project with webpack 4 configuration for development and production
Stars: ✭ 142 (-1.39%)
Mutual labels:  webpack
Despolitizador
🤥To translate political language for people's language
Stars: ✭ 139 (-3.47%)
Mutual labels:  webpack
Modern Wasm Starter
🛸 Run C++ code on web and create blazingly fast websites! A starter template to easily create WebAssembly packages using type-safe C++ bindings with automatic TypeScript declarations.
Stars: ✭ 140 (-2.78%)
Mutual labels:  webpack
Code Splitting React Webpack
An example of how to code split with Webpack 2 and React Router
Stars: ✭ 138 (-4.17%)
Mutual labels:  webpack
Webpackbar
Elegant ProgressBar and Profiler for Webpack 3 , 4 and 5
Stars: ✭ 1,887 (+1210.42%)
Mutual labels:  webpack
React Permissible
👮‍♂️Making the permission management for React components easier.
Stars: ✭ 145 (+0.69%)
Mutual labels:  webpack
Avvw
Apicloud + Vue2 + Vant(有赞前端)+ Webpack4打包,极速开发APP框架,将apicloud的渲染效率和vue数据绑定特性发挥极致!
Stars: ✭ 143 (-0.69%)
Mutual labels:  webpack
Vueport
Single file components for Rails with Vue JS and Webpack
Stars: ✭ 141 (-2.08%)
Mutual labels:  webpack

Tree-shaking example with Typescript and Webpack

devDependency Status

This repository shows how to configure Typescript and Webpack to enable tree-shaking. It will eliminate dead code if they have ES2015 module format.

The source code can be found in the app/ folder, where the main file car.js doesn't use all the dependencies from engine.js. The built and transpiled files can be found in the /dist folder.

Webpack only marks unused code at bundling and leaves the removing part to minifiers. This is why all the code is included in development builds in contrary to Rollup.

If you want a more detailed explanation, read this article.

Webpack + Typescript + UglifyJS

Can only remove unused functions and variables.

For development build run npm run webpack (Typescript -> ES5 bundle).

For production build run npm run webpack-prod (Typescript -> ES5 bundle -> UglifyJS).

When transpiling classes with Typescript, it generates an IIFE with an assignment to the prototype. It is considered as a side effect by UglifyJS and it skips removing of it.

See the issues below:

Webpack + Typescript + Babili

Can remove unused classes, functions and variables.

For development build run npm run webpack-es2015 (Typescript -> ES2015 bundle).

For production build run npm run webpack-es2015-prod (Typescript -> ES2015 bundle -> Babili).

It uses the Babili ES6+ aware minifier and solves the issues what UglifyJS has.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].