All Projects → Tinkoff → shared-library-webpack-plugin

Tinkoff / shared-library-webpack-plugin

Licence: other
Webpack plugin for library sharing at runtime between applications

Programming Languages

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

Projects that are alternatives of or similar to shared-library-webpack-plugin

chunk-progress-webpack-plugin
Provides runtime progress events by replacing default webpack chunk loading with XHR
Stars: ✭ 17 (-51.43%)
Mutual labels:  webpack-plugin
bundle-inspector-webpack-plugin
Bundle Inspector | Analysis Tool for Webpack
Stars: ✭ 19 (-45.71%)
Mutual labels:  webpack-plugin
ezinject
Modular binary injection framework, successor of libhooker
Stars: ✭ 47 (+34.29%)
Mutual labels:  shared-library
base-href-webpack-plugin
Webpack plugin for inserting base href tag in head block
Stars: ✭ 23 (-34.29%)
Mutual labels:  webpack-plugin
tinyimg-webpack-plugin
A webpack plugin for compressing image
Stars: ✭ 61 (+74.29%)
Mutual labels:  webpack-plugin
add-module-exports-webpack-plugin
Add `module.exports` for Babel and TypeScript compiled code
Stars: ✭ 36 (+2.86%)
Mutual labels:  webpack-plugin
meteor-imports-webpack-plugin
Webpack plugin to import and use Meteor packages like if they were real NPM packages.
Stars: ✭ 25 (-28.57%)
Mutual labels:  webpack-plugin
stylos
Webpack plugin to automatically generate and inject CSS utilities to your application
Stars: ✭ 60 (+71.43%)
Mutual labels:  webpack-plugin
prettier-webpack-plugin
Process your Webpack dependencies with Prettier
Stars: ✭ 47 (+34.29%)
Mutual labels:  webpack-plugin
webpack-auto-inject-version
Webpack plugin to auto inject version into html or file
Stars: ✭ 70 (+100%)
Mutual labels:  webpack-plugin
dva-typescript-antd-starter-kit
A admin dashboard application demo based on antd by typescript and dva
Stars: ✭ 61 (+74.29%)
Mutual labels:  webpack-plugin
asset-graph-webpack-plugin
Webpack plugin to easily get assets dependency graph based on entry point
Stars: ✭ 13 (-62.86%)
Mutual labels:  webpack-plugin
copy-modules-webpack-plugin
A Webpack plugin which copies module sources to a separate directory
Stars: ✭ 17 (-51.43%)
Mutual labels:  webpack-plugin
license-info-webpack-plugin
Making a list of package's LICENSE information for webpack
Stars: ✭ 20 (-42.86%)
Mutual labels:  webpack-plugin
swig-webpack-plugin
Render swig templates with webpack.
Stars: ✭ 12 (-65.71%)
Mutual labels:  webpack-plugin
inline-source-webpack-plugin
A webpack plugin to embed css/js resource in the html.
Stars: ✭ 18 (-48.57%)
Mutual labels:  webpack-plugin
webpack-ext-reloader
Add hot reloading to your webpack WebExtension! 🔥
Stars: ✭ 31 (-11.43%)
Mutual labels:  webpack-plugin
cmake cxx go
No description or website provided.
Stars: ✭ 13 (-62.86%)
Mutual labels:  shared-library
ignore-emit-webpack-plugin
Prevents ignored files from being emitted during a Webpack build
Stars: ✭ 17 (-51.43%)
Mutual labels:  webpack-plugin
chunk-splitting-plugin
Arbitrarily split your Webpack chunks and bundles into smaller pieces
Stars: ✭ 15 (-57.14%)
Mutual labels:  webpack-plugin

SharedLibraryWebpackPlugin

npm npm

SharedLibraryWebpackPlugin is a webpack plugin for sharing libraries between applications.

Motivation

When the host application loads many micro apps bundled with a webpack, many JavaScript is loaded on a client page. In a perfect world, each app can share its libraries with other apps and meet the requirements:

  1. Each app stays self-hosted.
  2. Fallbacks for non-loaded packages.
  3. Codesharing in runtime.
  4. Different library versions work individually.

SharedLibraryWebpackPlugin came to us from a perfect world!

Documentations

  1. Installation and configuration
  2. How is it works?
  3. Sharing and Tree shaking
  4. The Plugin API

Demo

There is a host application with two micro-apps. All apps are built with Angular. The client page loads 282.8kB of JavaScript (gzip) when it opens all pages.

We add SharedLibraryWebpackPlugin in each app build for sharing all Angular packages and zone.js.

const {
  SharedLibraryWebpackPlugin,
} = require('@tinkoff/shared-library-webpack-plugin');

module.exports = {
  plugins: [
    new SharedLibraryWebpackPlugin({
      libs: [
        { name: '@angular/core', usedExports: [] },
        { name: '@angular/common', usedExports: [] },
        { name: '@angular/common/http', usedExports: [] },
        { name: '@angular/platform-browser', usedExports: ['DomSanitizer'] },
        { name: '@angular/platform-browser/animations', usedExports: [] },
        { name: '@angular/animations', usedExports: [] },
        { name: '@angular/animations/browser', usedExports: [] },
        'zone.js/dist/zone',
      ],
    }),
  ],
};

After that, the client page loads 174.6kB of JavaScript! It is 38% less!

Contributing

License

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].