{"id":31970659,"url":"https://github.com/winjs-dev/webpack5-remove-use-strict-plugin","last_synced_at":"2025-10-14T19:18:01.922Z","repository":{"id":293002022,"uuid":"982649490","full_name":"winjs-dev/webpack5-remove-use-strict-plugin","owner":"winjs-dev","description":"Webpack 5 plugin to remove 'use strict' from the generated code","archived":false,"fork":false,"pushed_at":"2025-10-06T13:57:56.000Z","size":1365,"stargazers_count":1,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-06T15:32:46.485Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/winjs-dev.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-13T07:52:19.000Z","updated_at":"2025-08-25T00:26:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"6723c722-5e24-4261-94dc-e27e2cb89f5b","html_url":"https://github.com/winjs-dev/webpack5-remove-use-strict-plugin","commit_stats":null,"previous_names":["winjs-dev/webpack5-remove-use-strict-plugin"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/winjs-dev/webpack5-remove-use-strict-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winjs-dev%2Fwebpack5-remove-use-strict-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winjs-dev%2Fwebpack5-remove-use-strict-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winjs-dev%2Fwebpack5-remove-use-strict-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winjs-dev%2Fwebpack5-remove-use-strict-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/winjs-dev","download_url":"https://codeload.github.com/winjs-dev/webpack5-remove-use-strict-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winjs-dev%2Fwebpack5-remove-use-strict-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020655,"owners_count":26086895,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-10-14T19:18:00.342Z","updated_at":"2025-10-14T19:18:01.917Z","avatar_url":"https://github.com/winjs-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webpack5-remove-use-strict-plugin\n\n[![npm](https://img.shields.io/npm/v/@winner-fed/webpack5-remove-use-strict-plugin.svg)](https://npmjs.com/package/@winner-fed/webpack5-remove-use-strict-plugin)\n\n专为 Webpack 5 设计的移除 \"use strict\" 声明的插件。此插件可以从生成的 JavaScript 代码中删除所有 'use strict' 和 \"use strict\" 声明。\n\n## 背景\n\n在某些特定场景下，你可能需要移除 Webpack 生成代码中的 \"use strict\" 声明：\n\n- 当你需要在不支持严格模式的环境中运行代码\n- 当你的代码依赖于非严格模式的行为\n- 当你需要与特定的、不兼容严格模式的旧代码或库集成\n\n## 安装\n\n```bash\n# 使用 npm\nnpm install --save-dev @winner-fed/webpack5-remove-use-strict-plugin\n\n# 使用 yarn\nyarn add --dev @winner-fed/webpack5-remove-use-strict-plugin\n\n# 使用 pnpm\npnpm add --save-dev @winner-fed/webpack5-remove-use-strict-plugin\n```\n\n## 使用方法\n\n在你的 Webpack 配置文件中引入并使用此插件：\n\n### CommonJS 方式\n\n```js\nconst Webpack5RemoveUseStrictPlugin = require('@winner-fed/webpack5-remove-use-strict-plugin')\n\nmodule.exports = {\n  // ... 其他 webpack 配置\n  plugins: [\n    // ... 其他插件\n    new Webpack5RemoveUseStrictPlugin(),\n  ],\n}\n```\n\n### ES Module 方式\n\n```js\nimport Webpack5RemoveUseStrictPlugin from '@winner-fed/webpack5-remove-use-strict-plugin'\n\nexport default {\n  // ... 其他 webpack 配置\n  plugins: [\n    // ... 其他插件\n    new Webpack5RemoveUseStrictPlugin(),\n  ],\n}\n```\n\n## 工作原理\n\n该插件通过 Webpack 5 的 `processAssets` 钩子在优化资源阶段工作，可以移除所有生成的 JavaScript 文件中的 'use strict' 和 \"use strict\" 声明（不管有没有分号）。\n\n插件会：\n\n1. 监听 Webpack 的 `compilation` 钩子\n2. 在 `PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE` 阶段处理所有 JavaScript 资源\n3. 使用正则表达式查找并移除所有 \"use strict\" 声明\n4. 使用 Webpack 的 `RawSource` 更新资源内容\n\n## 兼容性\n\n本插件仅兼容 Webpack 5+，不支持 Webpack 4 或更早版本。\n\n## 许可证\n\n[MIT](./LICENSE) 许可证\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinjs-dev%2Fwebpack5-remove-use-strict-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwinjs-dev%2Fwebpack5-remove-use-strict-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinjs-dev%2Fwebpack5-remove-use-strict-plugin/lists"}