{"id":21392451,"url":"https://github.com/baymac/esm-cjs-interop","last_synced_at":"2025-03-16T13:42:14.819Z","repository":{"id":83255852,"uuid":"369323844","full_name":"baymac/esm-cjs-interop","owner":"baymac","description":"This repo demonstrates using both esmjs and cjs in your node project. Usually needed for migration.","archived":false,"fork":false,"pushed_at":"2021-05-20T20:08:50.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-23T01:23:34.721Z","etag":null,"topics":[],"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/baymac.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":"2021-05-20T19:57:57.000Z","updated_at":"2021-05-20T20:08:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"501884b3-4c0a-42be-a683-c60eda5c6440","html_url":"https://github.com/baymac/esm-cjs-interop","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baymac%2Fesm-cjs-interop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baymac%2Fesm-cjs-interop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baymac%2Fesm-cjs-interop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baymac%2Fesm-cjs-interop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baymac","download_url":"https://codeload.github.com/baymac/esm-cjs-interop/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243878454,"owners_count":20362432,"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-22T13:40:51.655Z","updated_at":"2025-03-16T13:42:14.790Z","avatar_url":"https://github.com/baymac.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node JS ESM and CJS Interop Demo\n\n## Pre-requisites\n\nNode \u003e= 13.2.0 (ships with ECMASscript Modules)\n\n## Project Structure\n\nIf you wish to add ESMJS support to your Common JS node project, you can do it in 2 ways. This repo contains 2 nodejs projects to demonstrates both ways:\n\n1. `cjs-default`: Demonstrates how to use ES modules in a CJS project (all \\*.js files are default treated as CJS). package.json contains `\"type\": \"commonjs\"`.\n1. `esm-default`: Demonstrates how to use CJS modules in a ESMJS project (all \\*.js files are default treated as ESMJS). package.json contains `\"type\": \"module\"`.\n\nBoth projects have 2 test files:\n\n1. `testCjs` - Written in CJS to show how to load ES modules. Run with `npm run cjs`.\n2. `testEsm` - Written is ESMJS to show how to load CJS modules. Run with `npm run esmjs`\n\n## References\n\n- https://nodejs.medium.com/announcing-core-node-js-support-for-ecmascript-modules-c5d6dc29b663\n- https://nodejs.org/api/modules.html\n- https://hacks.mozilla.org/2018/03/es-modules-a-cartoon-deep-dive/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaymac%2Fesm-cjs-interop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaymac%2Fesm-cjs-interop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaymac%2Fesm-cjs-interop/lists"}