{"id":13468525,"url":"https://github.com/developit/optimize-plugin","last_synced_at":"2025-05-16T08:03:54.176Z","repository":{"id":38376622,"uuid":"241025024","full_name":"developit/optimize-plugin","owner":"developit","description":"Optimized Webpack Bundling for Everyone. Intro ⤵️","archived":false,"fork":false,"pushed_at":"2023-02-02T10:59:14.000Z","size":79,"stargazers_count":658,"open_issues_count":5,"forks_count":14,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-09T16:11:39.224Z","etag":null,"topics":["modern-javascript","webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":"https://youtu.be/cLxNdLK--yI?t=662","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/developit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-17T05:13:49.000Z","updated_at":"2025-01-31T17:17:25.000Z","dependencies_parsed_at":"2023-02-08T14:01:39.625Z","dependency_job_id":null,"html_url":"https://github.com/developit/optimize-plugin","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Foptimize-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Foptimize-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Foptimize-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/developit%2Foptimize-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/developit","download_url":"https://codeload.github.com/developit/optimize-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493380,"owners_count":22080126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["modern-javascript","webpack","webpack-plugin"],"created_at":"2024-07-31T15:01:12.848Z","updated_at":"2025-05-16T08:03:54.122Z","avatar_url":"https://github.com/developit.png","language":"JavaScript","readme":"# Optimize Plugin for Webpack\n\nOptimize your code for modern browsers while still supporting the other 10%,\nincreasing your build performance, reducing bundle size and improving output quality.\n\nPut simply: it compiles code faster, better and smaller.\n\n## Features\n\n- Much faster than your current Webpack setup\n- Transparently optimizes all of your code\n- Automatically optimizes all of your dependencies\n- Compiles bundles for modern browsers (90%) and legacy browsers (10%)\n- Removes unnecessary polyfills, even when inlined into dependencies\n- Builds a highly-optimized automated polyfills bundle\n\n## Install\n\n```sh\nnpm install --save-dev optimize-plugin\n```\n\n## Usage\n\nFirst, disable any existing configuration you have to Babel, minification, and module/nomodule.\n\nThen, add `OptimizePlugin` to your Webpack plugins Array:\n\n```js\nplugins: [\n  new OptimizePlugin({\n    // any options here\n  })\n]\n```\n\n### Options\n\n| Option | Type | Description\n|---|---|---\n| `concurrency` | `number\\|false` | Maximum number of threads to use. Default: the number of available CPUs. \u003cbr\u003e_Pass `false` for single-threaded, sometimes faster for small projects._\n| `sourceMap` | `boolean\\|false` | Whether or not to produce source maps for the given input. |\n| `minify` | `boolean\\|false` | Minify using Terser, if turned off only comments will be stripped. |\n| `downlevel` | `boolean\\|true` | Produces a bundle for `nomodule` browsers. (IE11, ...) |\n| `modernize` | `boolean\\|true` | Attempt to upgrade ES5 syntax to equivalent modern syntax. |\n| `verbose` | `boolean\\|false` | Will log performance information and information about polyfills. |\n| `polyfillsFilename` | `string\\|polyfills.legacy.js` | The name for the chunk containing polyfills for the legacy bundle. |\n| `exclude` | `RegExp[]\\|[]` | Asset patterns that should be excluded |\n\n\n## How does this work?\n\nInstead of running Babel on each individual source code file in your project, `optimize-plugin`\ntransforms your entire application's bundled code. This means it can apply optimizations and\ntransformations not only to your source, but to your dependencies - making polyfill extraction\nand reverse transpilation steps far more effective.\n\nThis setup also allows `optimize-plugin` to achieve better performance. All work is done in\na background thread pool, and the same AST is re-used for modern and legacy transformations.\nPrevious solutions for module/nomodule have generally relied running two complete compilation\npasses, which incurs enormous overhead since the entire graph is built and traversed multiple\ntimes. With `optimize-plugin`, bundling and transpilation are now a separate concerns: Webpack\nhandles graph creation and reduction, then passes its bundles to Babel for transpilation.\n\n\u003cimg src=\"https://user-images.githubusercontent.com/105127/74685954-0cd21a80-519e-11ea-99f9-8fa5f3aef1b8.png\"\u003e\n\n## FAQ\n\n### What do I do with my current Babel configuration?\n\nIn order to migrate to optimize-plugin, you'll need to move your babel configuration into a `.babelrc` or `babel.config.js` file and remove `babel-loader` from your Webpack configuration. Remember, optimize-plugin only uses your babel configuration when generating _modern_ bundles. Legacy bundles are automatically compiled to ES5 without looking at your Babel configuration, though you can customize their compilation by defining a [browserslist](https://github.com/browserslist/browserslist) field in your package.json.\n\n### Do I need to include any polyfills manually?\n\nIn general, adopting optimize-plugin means removing all of your current polyfills, since the plugin automatically detects and polyfills JavaScript features for legacy bundles. The plugin does _not_ polyfill DOM features though, so be sure to keep including any DOM polyfills your application relies (`ParentNode.append()`, Module Workers, etc).\n\nRemember: the premise of this plugin is that you don't need to configure JS transpilation or polyfills - it's all done automatically based on usage.\n\n### License\n\nApache-2.0\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopit%2Foptimize-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevelopit%2Foptimize-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevelopit%2Foptimize-plugin/lists"}