GithubHelp home page GithubHelp logo

marcofugaro / browserslist-to-esbuild Goto Github PK

View Code? Open in Web Editor NEW
79.0 4.0 7.0 539 KB

Get esbuild-compatible targets from a browserlist config or project

License: MIT License

JavaScript 100.00%
browserslist esbuild esbuild-plugin targets browsers

browserslist-to-esbuild's People

Contributors

filipw01 avatar idleberg avatar kingyue737 avatar marcofugaro avatar realtayy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

browserslist-to-esbuild's Issues

Consider filtering out versions that cause ESBuild to fail

evanw/esbuild@0e1696f added some code that skips over bad version numbers from caniuse. Unfortunately that doesn't apply to values you explicitly supply through the target config.

For instance, if you use browserslist-to-esbuild right now it is likely not to work because of the presence of the version safariTP.

[ERROR] Invalid version: "TP"

  All version numbers passed to esbuild must be in the format "X", "X.Y", or "X.Y.Z" where X, Y, and Z are non-negative integers.

Repro: https://esbuild.github.io/try/#dAAwLjE5LjcAe3RhcmdldDonc2FmYXJpVFAnfQA

Related: evanw/esbuild#3501

Binary to execute conversion with npx

It'd be absolutely awesome if we could do the following in a project that has browserslist configured:

$ npx browserslist-to-esbuild

and see the output directly in the console.

Trouble importing version 2.1.0

Hello,

Firstly, I want to express my appreciation for the browserslist-to-esbuild package. It's been very useful in my projects.

Recently, I upgraded to version 2.1.0 and encountered an issue with the import statement in my vite.config.ts file. Here's how I'm using it:

import browserslistToEsbuild from 'browserslist-to-esbuild';

export default defineConfig({
   build: {
    target: browserslistToEsbuild()
  },
});

After the upgrade, the import fails with the error: Cannot find module 'browserslist-to-esbuild' or its corresponding type declarations.

I'm not an expert with NPM packages, but I found that modifying your package.json as shown below resolves the issue:

{
  "name": "browserslist-to-esbuild",
  ...
  "type": "module",
- "exports": {
-   "types": "./src/index.d.ts",
-   "default": "./src/index.js"
- }
+ "exports": {
+   ".": "./src/index.js"
+ },
+ "types": "./src/index.d.ts",
   ...
}

I'm not sure if I should be importing the module differently or if the exports field in package.json needs to be specified differently. Could you please provide some guidance on this? I can help out with a PR with this changes if that helps.

Thank you for your time and assistance.

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.