Code Monkey home page Code Monkey logo

transpile-node-modules's Introduction

transpile-node-modules 🧪

Vulnerabilities Version Downloads GitHub Workflow Status

CLI to transpile individual ESM packages to CommonJS with esbuild.

Install

pnpm i -g transpile-node-modules

Usage

transpile-node-modules <pkg> [target]
  • pkg - package to transpile
  • target - optional target environment (default: es2018)

transpile-node-modules's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

transpile-node-modules's Issues

Remove `type: "module"` also in package.json when transpiling ?

Thanks for your work, that's awesome
I'm trying to use it to transpile ESM node_modules like strip-json-comments

esmtocjs strip-json-comments

but it still throws:

const stripJsonComments = require('strip-json-comments')
                          ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/fritx/g/jsonmerge/node_modules/.pnpm/[email protected]/node_modules/strip-json-comments/index.js from /Users/fritx/g/jsonmerge/jsonc.js not supported.
Instead change the require of index.js in /Users/fritx/g/jsonmerge/jsonc.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/Users/fritx/g/jsonmerge/jsonc.js:4:27)

It seems that we should remove type: "module" also in package.json?

-  "type": "module",
  "exports": "./index.js",
+  "main": "./index.cjs"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.