{"id":20623465,"url":"https://github.com/gxlmyacc/build-react-esm-project","last_synced_at":"2026-01-31T17:04:04.240Z","repository":{"id":57685200,"uuid":"473443269","full_name":"gxlmyacc/build-react-esm-project","owner":"gxlmyacc","description":"a react build command that will transform js/jsx/images/scss/less with gulp-babel/postcss/scss/less plugin, this is a good way to release an NPM package. ","archived":false,"fork":false,"pushed_at":"2024-12-03T08:25:50.000Z","size":291,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-26T15:37:37.206Z","etag":null,"topics":["babel","build-tool","esm","npm-package","postcss","react"],"latest_commit_sha":null,"homepage":"","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/gxlmyacc.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}},"created_at":"2022-03-24T03:27:40.000Z","updated_at":"2024-12-03T08:25:54.000Z","dependencies_parsed_at":"2025-01-17T05:41:31.982Z","dependency_job_id":"77b60b89-2055-484d-b84d-a6eebc7a5e55","html_url":"https://github.com/gxlmyacc/build-react-esm-project","commit_stats":{"total_commits":22,"total_committers":1,"mean_commits":22.0,"dds":0.0,"last_synced_commit":"b1ebf5e9f7d23c7fcd4c5dbb25e4db77012780bd"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/gxlmyacc/build-react-esm-project","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gxlmyacc%2Fbuild-react-esm-project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gxlmyacc%2Fbuild-react-esm-project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gxlmyacc%2Fbuild-react-esm-project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gxlmyacc%2Fbuild-react-esm-project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gxlmyacc","download_url":"https://codeload.github.com/gxlmyacc/build-react-esm-project/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gxlmyacc%2Fbuild-react-esm-project/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28948356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T14:26:55.697Z","status":"ssl_error","status_checked_at":"2026-01-31T14:26:52.545Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["babel","build-tool","esm","npm-package","postcss","react"],"created_at":"2024-11-16T12:27:17.322Z","updated_at":"2026-01-31T17:04:04.218Z","avatar_url":"https://github.com/gxlmyacc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# build-react-esm-project\n\na react build command that will transform js/jsx/images/scss/less with gulp-babel/postcss/scss/less plugin, \nthis is a good way to release an NPM package. see [demo](https://github.com/gxlmyacc/build-react-esm-project/tree/master/demo)\n\n## Installtion\n\n```bash\n  npm install --save-dev build-react-esm-project\n  // or \n  yarn add -D build-react-esm-project\n```\n\n## Usage\n\nsupport \"build\"、\"start\" command:\n\n\"build\" command:\n```bash\n## \"build\" command options:\n##   --root \u003cpath\u003e            provide project root directory, default process.cwd()\n##   --build-config \u003cpath\u003e    provide build esm config file path, default is process.cwd()/esm-project.config.js\n##   --babel-config \u003cpath\u003e    provide babel config file path, default is process.cwd()/babel.config.js\n##   --postcss-config \u003cpath\u003e  provide postcss config file path, default is process.cwd()/postcss.config.js\n##   --less-config \u003cpath\u003e     provide less config file path, default is process.cwd()/less.config.js\n##   --scss-config \u003cpath\u003e     provide scss config file path, default is process.cwd()/scss.config.js\n##   --ignore \u003cpath\u003e          provide igonre transfrom files\n##   --src \u003cpath\u003e             source directory, default is src\n##   --out \u003cpath\u003e             output directory, default is esm\n##   -ts, --typescript,       is typescript project\n##    --sourcemap             generate scripts`s sourcemap\n##\n##   --scope-style            enable scope style for scripts/styles files. \n##   --scope-namespace \u003cnamespace\u003e scope namespace, default is \"namespace\" field in process.cwd()/package.json\n##   --alias                  handle alias in scripts/styles file\n##   --alias-config \u003cpath\u003e    provide alias config file path, default is process.cwd()/alias.config.js\n##   --define                 handle define in scripts file\n##   --define-config \u003cpath\u003e   provide define config file path\n\nreact-esm-project build\n```\n\"start\" command:\n```bash\n## \"start\" command options:\n##   --root \u003cpath\u003e            provide project root directory, default process.cwd()\n##   --build-config \u003cpath\u003e    provide build esm config file path, default is process.cwd()/esm-project.config.js\n##   --babel-config \u003cpath\u003e    provide babel config file path, default is process.cwd()/babel.config.js\n##   --postcss-config \u003cpath\u003e  provide postcss config file path, default is process.cwd()/postcss.config.js\n##   --less-config \u003cpath\u003e     provide less config file path, default is process.cwd()/less.config.js\n##   --scss-config \u003cpath\u003e     provide scss config file path, default is process.cwd()/scss.config.js\n##   --ignore \u003cpath\u003e          provide igonre transfrom files\n##   --src \u003cpath\u003e             source directory, default is src\n##   --out \u003cpath\u003e             output directory, default is esm\n##   -ts, --typescript,       is typescript project\n##    --sourcemap             generate scripts`s sourcemap\n##    --disable-clean         whether disable clean dist files\n##\n##   --scope-style            enable scope style for scripts/styles files. \n##   --scope-style-version    whether apply scope style with version. \n##   --scope-namespace \u003cnamespace\u003e scope namespace, default is \"namespace\" field in process.cwd()/package.json\n##   --alias                  handle alias in scripts/styles file\n##   --alias-config \u003cpath\u003e    provide alias config file path, default is process.cwd()/alias.config.js\n##   --define                 handle define in scripts file\n##   --define-config \u003cpath\u003e   provide define config file path\n\nreact-esm-project start\n```\n\\\n\n### scope-style\n\n`--scope-style` will enable `scope style`, see [babel-preset-react-scope-style](https://github.com/gxlmyacc/babel-preset-react-scope-style)\n\n### alias\n  \n`--alias` will enable `handle aliases in scripts/styles file`, see [babel-plugin-alias-config](https://github.com/gxlmyacc/babel-plugin-alias-config) and [postcss-alias-config](https://github.com/gxlmyacc/postcss-alias-config)\n\n### define\n\n`--alias` will enable ` handle define in scripts file`, see [babel-plugin-define-variables](https://github.com/gxlmyacc/babel-plugin-define-variables)\n## configuration\n\nyou also can config the `esm-project.config.js` to custom do something:\n```js\n// esm-project.config.js: \nmodule.exports = {\n  cleanEsm(buildOptions, options) {\n    // return false will skip\n  },\n  buildJs(buildOptions, babelConfig, options) {\n    // return false will skip\n  },\n  buildPostcss(buildOptions, postcssPlugins, options) {\n    // return false will skip\n  },\n  buildLess(buildOptions, lessConfig, options) {\n    // return false will skip\n  },\n  buildScss(buildOptions, scssConfig, options) {\n    // return false will skip\n  },\n  buildCss(buildOptions, cssConfig, options) {\n    // return false will skip\n  },\n  buildOthers(buildOptions, othersConfig, options) {\n    // return false will skip\n  },\n}\n```\n\nThe following is the type definition of `esm-project.config.js`:\n```ts\ninterface BuildOptions {\n  root?: string,\n  esmConfig?: string,\n  babelConfig?: string,\n  postcssConfig?: string,\n  lessConfig?: string,\n  scssConfig?: string,\n  ignore?: string[],\n  src?: string,\n  out?: string,\n  typescript?: boolean,\n  sourcemap?: boolean,\n  scopeStyle?: boolean,\n  scopeNamespace?: boolean,\n  alias?: boolean,\n  aliasConfig?: string,\n  define?: boolean,\n  defineConfig?: string,\n  [key: string]: any\n}\n\ninterface BabelConfig {\n  presets?: Record\u003cstring, any\u003e,\n  plugins?: Record\u003cstring, any\u003e,\n  [key: string]: any\n}\n\n\ninterface GulpOptions {\n  rootDir: string,\n  distDir: string,\n  srcDir: string,\n  jsMask: string,\n  cssMask: string,\n  scssMask: string,\n  lessMask: string,\n  otherMask: string,\n  ignore: string[],\n  babelConfigFile: string,\n  postcssConfigFile: string,\n  lessConfigFile: string,\n  scssConfigFile: string,\n  esmConfigFile: string,\n  commandPrefx: string,\n  sourcemap?: boolean,\n\n  [key: string]: any\n}\n\ninterface GulpOptionsWithDone extends GulpOptions {\n  done: (result?: any) =\u003e void,\n  file: any\n}\n\ninterface EsmConfig {\n  cleanEsm?: (buildConfig: BuildOptions, options: GulpOptions) =\u003e void|false,\n  buildJs?: (buildConfig: buildOptions, babelConfig: BabelConfig, options: GulpOptionsWithDone) =\u003e void|false,\n  buildPostcss?: (buildConfig: buildOptions, postcssPlugins: Record\u003cstring, function\u003e, options: GulpOptions) =\u003e void|false,\n  buildLess?: (buildConfig: buildOptions, lessConfig: Record\u003cstring, any\u003e, options: GulpOptionsWithDone) =\u003e void|false,\n  buildScss?: (buildConfig: buildOptions, scssConfig: Record\u003cstring, any\u003e, options: GulpOptionsWithDone) =\u003e void|false,\n  buildCss?: (buildConfig: buildOptions, cssConfig: { plugins: Record\u003cstring, function\u003e }, options: GulpOptionsWithDone) =\u003e void|false,\n  buildOthers?: (buildConfig: buildOptions, othersConfig: Record\u003cstring, any\u003e, options: GulpOptionsWithDone) =\u003e void|false\n}\n\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgxlmyacc%2Fbuild-react-esm-project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgxlmyacc%2Fbuild-react-esm-project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgxlmyacc%2Fbuild-react-esm-project/lists"}