Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 4, 2022. It is now read-only.
/cjs-to-es6Public archive

CLI to convert CommonJS to ES6 modules (UNMAINTAINED)

License

NotificationsYou must be signed in to change notification settings

nolanlawson/cjs-to-es6

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maintenance notice: this package is no longer under active maintenance.

CLI to convert JavaScript files fromCommonJS toES6 / ES2015 modules format. The process isn't foolproof, but it can usually get you ~95% of the way there.

This tool usesjscodeshift to run5to6-codemod andjs-codemod under the hood. It attempts to convertrequire() andmodule.exports /exports toimport andexport.

Install

npm i -g cjs-to-es6

Usage

cjs-to-es6 [ --verbose ] files/directories...

All files are modified in-place. You may want to review & rename them to the.mjs extension, if usingNode 14 or later. Un-converted files should use the.cjs extension.

Examples:

cjs-to-es6 index.js             # convert a single filecjs-to-es6 lib/                 # convert all files in a directory & its subdirectories (.js & .cjs)cjs-to-es6 foo.js bar.js lib/   # convert many files/directories

About

CLI to convert CommonJS to ES6 modules (UNMAINTAINED)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp