GithubHelp home page GithubHelp logo

converted-esm/import-meta-resolve.js single-file CJS is unnecessarily huge due to non-ESM node_modules externals bundled by esbuild about eslint-plugin-n HOT 5 CLOSED

eslint-community avatar eslint-community commented on June 20, 2024
converted-esm/import-meta-resolve.js single-file CJS is unnecessarily huge due to non-ESM node_modules externals bundled by esbuild

from eslint-plugin-n.

Comments (5)

danielweck avatar danielweck commented on June 20, 2024

Add externals to esbuild CLI:
https://github.com/weiran-zsd/eslint-plugin-node/blob/26448e08477ef1d6b55f304609bf038a0a970a3f/scripts/convert-pure-esm-to-cjs.js#L4

from eslint-plugin-n.

danielweck avatar danielweck commented on June 20, 2024

For example, the bundled NPM packages builtins, semver, and yallist are all CJS, not ESM:
https://unpkg.com/browse/builtins/
https://unpkg.com/browse/semver/
https://unpkg.com/browse/yallist/
... so they should be externalised from the esbuild bundle, which otherwise is a huge payload of hard-to-review (and trust) code shipped to developers / users of the esling-plugin-node fork.

from eslint-plugin-n.

danielweck avatar danielweck commented on June 20, 2024

ping @aladdin-add @voxpelli @giltayar
๐Ÿ‘

Thanks for your work ๐Ÿ˜ธ

from eslint-plugin-n.

danielweck avatar danielweck commented on June 20, 2024

From 109KB down to 32KB, just by externalising CJS NPM packages builtins yallist and semver:

npx esbuild --platform=node --external:builtins --external:yallist --external:semver --bundle node_modules/import-meta-resolve/lib/resolve.js > lib/converted-esm/import-meta-resolve.js

=>

Screenshot 2022-02-23 at 07 10 02

from eslint-plugin-n.

danielweck avatar danielweck commented on June 20, 2024

Pull Request: #10

from eslint-plugin-n.

Related Issues (20)

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.