SharedLibraryWebpackPlugin
1.0.0
1.0.0
  • SharedLibraryWebpackPlugin
  • Documentation
    • Installation and Configuration
    • How does it work?
    • Sharing and Tree shaking
    • The Plugin
  • Contributor Covenant Code of Conduct
  • Contributing
  • License
Powered by GitBook
On this page
  • Installation
  • Configuration
  • How does it work?

Was this helpful?

Export as PDF
  1. Documentation

Installation and Configuration

Installation

The plugin can install by any package manager.

npm i @tinkoff/shared-library-webpack-plugin -D

or

yarn add @tinkoff/shared-library-webpack-plugin --dev

Configuration

Add plugin to webpack configuration file and set a list of libraries for sharing. There is an example with lodash:

import { SharedLibraryWebpackPlugin } from '@tinkoff/shared-library-webpack-plugin';

module.exports = {
  plugin: [
    new SharedLibraryWebpackPlugin({
      libs: 'lodash',
    }),
  ],
};

The plugin adds one more chunk with a hashed name to the bundle. It should be a shared lodash. When the application is loaded, the webpack runtime will check if lodash is loaded.

PreviousDocumentationNextHow does it work?

Last updated 4 years ago

Was this helpful?

How does it work?