{"id":18603027,"url":"https://github.com/ymfe/ykit-config-es6","last_synced_at":"2025-08-03T18:33:02.108Z","repository":{"id":71565535,"uuid":"98501959","full_name":"YMFE/ykit-config-es6","owner":"YMFE","description":null,"archived":false,"fork":false,"pushed_at":"2018-06-14T06:15:12.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-05-24T01:47:41.229Z","etag":null,"topics":["ykit","ykit-plugin"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/YMFE.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2017-07-27T06:34:29.000Z","updated_at":"2019-01-15T03:31:16.000Z","dependencies_parsed_at":"2023-05-01T10:32:07.569Z","dependency_job_id":null,"html_url":"https://github.com/YMFE/ykit-config-es6","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/YMFE/ykit-config-es6","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YMFE%2Fykit-config-es6","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YMFE%2Fykit-config-es6/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YMFE%2Fykit-config-es6/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YMFE%2Fykit-config-es6/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YMFE","download_url":"https://codeload.github.com/YMFE/ykit-config-es6/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YMFE%2Fykit-config-es6/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268594120,"owners_count":24275733,"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-08-03T02:00:12.545Z","response_time":2577,"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":["ykit","ykit-plugin"],"created_at":"2024-11-07T02:13:18.033Z","updated_at":"2025-08-03T18:33:02.099Z","avatar_url":"https://github.com/YMFE.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ykit-config-es6\n\n## Features\n\n- 编译 ES6+代码（兼容至 IE8）\n- 通过 happypack 提升编译速度\n- 添加 babel-polyfill\n\n## 安装\n\n在项目中执行：\n\n```\n$ npm install ykit-config-es6 --save\n```\n\n编辑 `ykit.js`，引入插件即可：\n\n```\nmodule.exports = {\n    plugins: ['es6']\n    // ...\n};\n```\n\n## babel-polyfill\n\nbabel-polyfill 默认是没有引入的，需要根据项目需求手动引入。\n\n### 功能\n\nbabel 默认只转换新的 JavaScript 句法（syntax），而不转换新的 API，比如 Iterator、Generator、Set、Maps、Proxy、Reflect、Symbol、Promise 等全局对象，以及一些定义在全局对象上的方法（比如 Object.assign ）都不会转码。如果需要这些 API 则要手动引入 babel-polyfill。\n\n### 引入\n\n引入 babel-polyfill 需要在入口 js 头部，加入如下一行代码：\n\n```javasciprt\nimport 'babel-polyfill';\n```\n\n\u003cb class=\"ykit-tip\"\u003e\nbabel-polyfill 会增大 js 体积（压缩后 80k 左右），请根据项目需求选择是否引入。\n\u003c/b\u003e\n\n## 配置项\n\n### ie8 支持\n\n如果要支持 ie8 请传入配置项：\n\n```javascript\nmodule.exports = {\n    plugins: [\n        {\n            name: 'es6',\n            options: {\n                ie8: true\n            }\n        }\n    ]\n};\n```\n\n### 更改 ES6 编译配置\n\n该插件支持更改 babel-loader 的 `test`、`exclude`、`query` 配置项：\n\n```javascript\nmodule.exports = {\n    plugins: [\n        'qunar', {\n            // 通过对象的方式引入插件，可以传入 options\n            name: 'es6',\n            options: {\n                // 更改 es6 配置\n                test: /\\.(js)$/, // 默认是 /\\.(js|jsx)$/\n                exclude: /node_modules\\/(?!(MY_UI)\\/).*/, // 默认是 /node_modules/\n                modifyQuery: function(defaultQuery) { // 可查看和编辑 defaultQuery\n                    defaultQuery.presets.push('my_preset');\n                    defaultQuery.plugins.push('my_plugin');\n                    return defaultQuery;\n                }\n            }\n        }\n    ],\n    config: {\n        // ...\n    }\n};\n```\n\n**注意：更改 bebal-loader 配置后有可能不会立即生效，此时需要清除一下缓存，重新安装 node_modules 即可。**\n\n### 禁用严格模式\n\nBabel 会默认为 JS 文件添加严格模式，如果想要禁用它可以传入 removeStrict 参数\n\n```javascript\nmodule.exports = {\n    plugins: [\n        {\n            name: 'es6',\n            options: {\n                removeStrict: true\n            }\n        }\n    ]\n};\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymfe%2Fykit-config-es6","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fymfe%2Fykit-config-es6","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fymfe%2Fykit-config-es6/lists"}