Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@ampproject/rollup-plugin-closure-compiler
Advanced tools
Leverage Closure Compiler to minify and optimize JavaScript with Rollup.
Generally Closure Compiler will produce superior minification than other projects, but historically has been more difficult to use. The goal of this plugin is to reduce this friction.
npm install @ampproject/rollup-plugin-closure-compiler --save-dev
Invoke Closure Compiler from your Rollup configuration.
// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';
export default {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'iife',
},
plugins: [
compiler(),
],
}
If you would like to provide additional flags and options to Closure Compiler, pass them via key-value pairs.
// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';
export default {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'iife',
},
plugins: [
compiler({
formatting: 'PRETTY_PRINT'
}),
],
}
This plugin will modify the enable the assume_function_wrapper
output option for Closure Compiler when es
format is specifed to Rollup. Note: This is overrideable via passed flags and options.
// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';
export default {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'es',
},
plugins: [
compiler(),
],
}
If your Rollup configuration outputs an IIFE format bundle with a specified name, this plugin will add an extern to ensure the name does not get mangled. Note: This is overrideable via passed flags and options.
// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';
export default {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'iife',
name: 'MyAwesomeThing'
},
plugins: [
compiler(),
],
}
The AMP Project accepts responsible security disclosures through the Google Application Security program.
The AMP Project strives for a positive and growing project community that provides a safe environment for everyone. All members, committers and volunteers in the community are required to act according to the code of conduct.
rollup-plugin-closure-compiler is licensed under the Apache License, Version 2.0.
FAQs
Rollup + Google Closure Compiler
We found that @ampproject/rollup-plugin-closure-compiler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 16 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.