marcofugaro / browserslist-to-esbuild Goto Github PK
View Code? Open in Web Editor NEWGet esbuild-compatible targets from a browserlist config or project
License: MIT License
Get esbuild-compatible targets from a browserlist config or project
License: MIT License
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
Config files like:
[production]
> 1%
not dead
[modern]
last 1 chrome version
last 1 firefox version
[ssr]
node 12
In following two lines i guess you still have the wrong command documented since in your 2.0.0 release you say that browserslist
is now a peer dependency
browserslist-to-esbuild/readme.md
Line 12 in f4126fc
npm install --save-dev browserslist browserslist-to-esbuild
browserslist-to-esbuild/readme.md
Line 18 in f4126fc
yarn add --dev browserslist browserslist-to-esbuild
Hello,
the module works fine but when importing in webpack.config.js I get a eslint error
error Unable to resolve path to module 'browserslist-to-esbuild' import/no-unresolved
Best
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.
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.
According to the esbuild docs, IE and Opera are supported targets, but SUPPORTED_ESBUILD_TARGETS
doesn't contain IE nor Opera.
Also, Samsung Internet is chromium-based, so could be mapped.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.