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
  • SharedLibraryWebpackPlugin
  • Options
  • SharedLibrarySearchConfig

Was this helpful?

Export as PDF
  1. Documentation

The Plugin

PreviousSharing and Tree shakingNextContributor Covenant Code of Conduct

Last updated 4 years ago

Was this helpful?

SharedLibraryWebpackPlugin

SharedLibraryWebpackPlugin is a class that implements webpack plugin functionality,

Options

libs

string | SharedLibrarySearchConfig | Array<string | SharedLibrarySearchConfig>

An option that configures the search for shared libraries and the formation of a chunk name. It can be a string or or an array of them.

new SharedLibraryWebpackPlugin({
    libs: 'lodash'
});

new SharedLibraryWebpackPlugin({
    libs: '@angular/**'
});

new SharedLibraryWebpackPlugin({
    libs: ['@angular/**', 'zone.js/dist/zone']
});

new SharedLibraryWebpackPlugin({
   libs: {name: '@angular/core', chunkName: 'ng', separator: '@'}
});

namespace

string

The namespace for saving exported libraries

{
    namespace: "__shared_libraries__"
}

disableDefaultJsonpFunctionChange

boolean

By default: false

If true jsonpFunction will be replaced with a random name

{
    disableDefaultJsonpFunctionChange: false
}

SharedLibrarySearchConfig

SharedLibrarySearchConfig configures the search for sharing library and the formation of a chunk name.

pattern

string

An option to search for libraries in a bundle.

{
    pattern: "@angular/**"
}

name

string

A name to search for a library in a bundle.

{
    name: "@angular/core"
}

chunkName

string

A name of a shared chunk

If a pattern exists chunkName is ignored

{
    chunkName: "ng"
}

suffix

string

A chunk name suffix

By default library version {major}.{minor}-{prerelease}

{
    suffix: 'suffix'
}

separator

string

Separator for a chunk name and suffix

{
    separator: "@"
}

deps

string[]

Libraries that the current one depends on.

new SharedLibraryWebpackPlugin({
   libs: [
      '@angular/**', 
      {name: '@tinkoff/angular-ui', deps: ['@angular/core']}
   ]
})

usedExports

string[]

The import names to be used by another application

{name: '@angular/core', usedExports: ['DomSanitizer']}
SharedLibrarySearchConfig