I looked through kangax's compatibility tables and explored using native Promise support as a proxy for "good enough" ES6 support. Providing a way for module authors to specify whether or not their code should be run in a legacy context could help streamline things.ĮS6 compatibility isn't easy to test for, because there are so many aspects of ES6. There will likely be a lengthy transitional period where a few features are written this way but most are still backwards-compatible with ES5. If a team is developing a new feature which already provides a no-JS fallback, they may decide that the JS-enhanced version doesn't need to jump through the extra hoops to support IE11. So maybe it's less about which minifier to use and more about giving developers the ability to decide whether or not to support legacy browsers on a per-module basis. In browsers that support ES5 but not ES6 (like IE11), we'd presumably want to execute the ES5-compatible modules, but not the ES6 ones. ResourceLoader currently does not have a concept of per-module executability, only a global one: the startup code feature-detects ES5 support, and either decides that no JavaScript is going to be executed or that everything can be. Modules that are flagged as using ES6 should not be executed in browsers that don't support ES6 (most prominently including IE11). Import * as esbuild from 'esbuild' let result = await esbuild.Alongside this, I think we should also formalize the notion of grade B (in between grade A and grade C) in ResourceLoader. Here's a simple example that enables bundling with an output directory:ĬLI JS Go esbuild app.ts -bundle -outdir=dist You typically pass one or more entry point files to process along with various options, and then esbuild writes the results back out to the file system. This is the primary interface to esbuild. Each is described below at a high level, followed by documentation for each individual API option. The two most commonly-used esbuild APIs are build and transform. There is separate documentation for both of the public Go packages: pkg/api and pkg/cli. Go: If you are using Go, you may find the automatically generated Go documentation for esbuild helpful as a reference. You may also find the TypeScript type definitions for esbuild helpful as a reference. JavaScript: If you are using JavaScript be sure to check out the JS-specific details and browser sections below. The form -foo is used for enabling boolean flags such as -minify, the form -foo=bar is used for flags that have a single value and are only specified once such as -platform=, and the form -foo:bar is used for flags that have multiple values and can be re-specified multiple times such as -external. Some specifics for each language:ĬLI: If you are using the command-line API, it may be helpful to know that the flags come in one of three forms: -foo, -foo=bar, or -foo:bar. You can switch between languages using the CLI, JS, and Go tabs in the top-right corner of each code example. The concepts and parameters are largely identical between the three languages so they will be presented together here instead of having separate documentation for each language. The API can be accessed in one of three languages: on the command line, in JavaScript, and in Go.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |