{"id":21541492,"url":"https://github.com/Richienb/node-polyfill-webpack-plugin","last_synced_at":"2025-07-16T11:32:19.665Z","repository":{"id":39514423,"uuid":"303600210","full_name":"Richienb/node-polyfill-webpack-plugin","owner":"Richienb","description":"Polyfill Node.js core modules in Webpack.","archived":false,"fork":false,"pushed_at":"2024-05-24T11:28:03.000Z","size":56,"stargazers_count":294,"open_issues_count":15,"forks_count":32,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-11-19T14:57:51.423Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Richienb.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"liberapay":"richienb"}},"created_at":"2020-10-13T05:44:51.000Z","updated_at":"2024-11-19T09:47:27.000Z","dependencies_parsed_at":"2024-06-18T12:29:40.455Z","dependency_job_id":"cfd7dd27-213a-4b8c-a1c0-4ba4058354f6","html_url":"https://github.com/Richienb/node-polyfill-webpack-plugin","commit_stats":{"total_commits":47,"total_committers":12,"mean_commits":"3.9166666666666665","dds":0.276595744680851,"last_synced_commit":"fc4e0a9e27fe14037245848b8363830a89c12ed6"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":"Richienb/node-module-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Richienb%2Fnode-polyfill-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Richienb%2Fnode-polyfill-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Richienb%2Fnode-polyfill-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Richienb%2Fnode-polyfill-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Richienb","download_url":"https://codeload.github.com/Richienb/node-polyfill-webpack-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226118864,"owners_count":17576405,"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":[],"created_at":"2024-11-24T05:03:24.299Z","updated_at":"2024-11-24T05:03:25.339Z","avatar_url":"https://github.com/Richienb.png","language":"JavaScript","funding_links":["https://liberapay.com/richienb"],"categories":["JavaScript","Plugins"],"sub_categories":["Rspack Plugins"],"readme":"# node-polyfill-webpack-plugin\n\nPolyfill Node.js core modules in Webpack.\n\nThis module is only needed for [Webpack 5+](https://github.com/webpack/changelog-v5#automatic-nodejs-polyfills-removed).\n\n## Install\n\n```sh\nnpm install node-polyfill-webpack-plugin\n```\n\n## Usage\n\nAdd the following to your `webpack.config.js`:\n\n```js\nconst NodePolyfillPlugin = require('node-polyfill-webpack-plugin');\n\nmodule.exports = {\n\t// Other rules...\n\tplugins: [\n\t\tnew NodePolyfillPlugin(),\n\t],\n};\n```\n\n`console`, `process`, and most deprecated/internal Node.js core modules are not polyfilled by default. If you still need to polyfill them, you can use the `additionalAliases` option:\n\n```js\nconst NodePolyfillPlugin = require('node-polyfill-webpack-plugin');\n\nmodule.exports = {\n\t// Other rules...\n\tplugins: [\n\t\tnew NodePolyfillPlugin({\n\t\t\tadditionalAliases: ['process', 'punycode'],\n\t\t}),\n\t],\n};\n```\n\nThe `fs` module resolves to nothing because its functionality cannot replicated in the browser.\n\n## API\n\n### new NodePolyfillPlugin(options?)\n\n#### options\n\nType: `object`\n\n`onlyAliases` is mutually exclusive with `excludeAliases` and `additionalAliases`.\n\n#### excludeAliases\n\nIf you don't want a module to be polyfilled, you can specify aliases to be skipped here.\n\n```js\nconst NodePolyfillPlugin = require('node-polyfill-webpack-plugin');\n\nmodule.exports = {\n\t// Other rules...\n\tplugins: [\n\t\tnew NodePolyfillPlugin({\n\t\t\texcludeAliases: ['console'],\n\t\t}),\n\t],\n};\n```\n\n#### additionalAliases\n\nAlternatively, you can choose to add certain aliases to the list of polyfilled modules. For example, you can choose to polyfill `console`.\n\n```js\nconst NodePolyfillPlugin = require('node-polyfill-webpack-plugin');\n\nmodule.exports = {\n\t// Other rules...\n\tplugins: [\n\t\tnew NodePolyfillPlugin({\n\t\t\tadditionalAliases: ['console'],\n\t\t}),\n\t],\n};\n```\n\n#### onlyAliases\n\nYou can also choose to only include certain aliases, ignoring the defaults. For example, you can have only `console` polyfilled.\n\n```js\nconst NodePolyfillPlugin = require('node-polyfill-webpack-plugin');\n\nmodule.exports = {\n\t// Other rules...\n\tplugins: [\n\t\tnew NodePolyfillPlugin({\n\t\t\tonlyAliases: ['console'],\n\t\t}),\n\t],\n};\n```\n\n## Aliases\n\n### Globals\n\n- `Buffer`\n- `console`\n- `process`\n\n### Modules\n\n- `assert`\n- `buffer`\n- `console`\n- `constants`\n- `crypto`\n- `domain`\n- `events`\n- `http`\n- `https`\n- `os`\n- `path`\n- `punycode`\n- `process`\n- `querystring`\n- `stream`\n- `_stream_duplex`\n- `_stream_passthrough`\n- `_stream_readable`\n- `_stream_transform`\n- `_stream_writable`\n- `string_decoder`\n- `sys`\n- `timers`\n- `tty`\n- `url`\n- `util`\n- `vm`\n- `zlib`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRichienb%2Fnode-polyfill-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRichienb%2Fnode-polyfill-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRichienb%2Fnode-polyfill-webpack-plugin/lists"}