Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
disable-tree-shaking-for-chunk-plugin
Advanced tools
Readme
This plugin for Webpack 4 can disable tree shaking for all modules contained in a specific chunk. It is intended to help improve long-term caching and code reuse between project installations and builds.
This is a Node.js module available through the npm registry. Node 8 and Webpack 4.38 or higher are required.
Installation is done using the npm install command:
$ npm install --save-dev disable-tree-shaking-for-chunk-plugin
Once installed the plugin can be added to your Webpack plugins configuration:
const DisableTreeShakingForChunk = require('disable-tree-shaking-for-chunk-plugin')
module.exports = {
//...
plugins: [
new DisableTreeShakingForChunk({
test: 'chunk-name'
})
]
}
test
(string, RegExp, Function, Array, Set)Matches the chunk name. It may be a string matched with strict equality, a regular expression for more complex string matching, a function which will receive the chunk name as an argument and should return a boolean, or an array or set of strings.
Below demonstrates part of a Webpack configuration file which sets up code splitting for a project. It has two groups defined, one using an array of package names and another with a regular expression.
An instance of this plugin is created for each group with the test
parameter configured to match all of the generated chunks.
const DisableTreeShakingForChunk = require('disable-tree-shaking-for-chunk-plugin')
const commonLibraries = ['react', 'redux', 'regenerator-runtime']
const designSystemComponent = /node_modules\/@organisation\/component-/
module.exports = {
optimization: {
splitChunks: {
cacheGroups: {
commonLibraries: {
test(module) {
const packageName = getPackageName(module.context)
return packageName ? commonLibraries.includes(packageName) : false
},
name(module) {
return getPackageName(module.context)
}
},
designSystemComponents: {
test(module) {
return designSystemComponent.test(module.context)
},
name(module) {
const packageName = getPackageName(module.context)
return packageName.replace('@', '').replace('/', '--')
}
}
}
}
},
plugins: [
new DisableTreeShakingForChunk({
test: commonLibraries
}),
new DisableTreeShakingForChunk({
test: /^organisation--component-/
})
]
}
This plugin is based upon Webpack's internal FlagInitialModulesAsUsedPlugin
by Tobias Koppers.
This project uses Prettier for automatic code formatting and is tested with Jasmine.
This package is MIT licensed.
FAQs
This plugin for Webpack can disable tree shaking for all modules contained in a specific chunk. It is intended to help improve long-term caching and code reuse between project installations and builds.
The npm package disable-tree-shaking-for-chunk-plugin receives a total of 178 weekly downloads. As such, disable-tree-shaking-for-chunk-plugin popularity was classified as not popular.
We found that disable-tree-shaking-for-chunk-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.