-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[typescript] Support esbuild, second attempt #11465
[typescript] Support esbuild, second attempt #11465
Conversation
e715416
to
6879aaa
Compare
Ugh, seems pupeteer does not readily work in the pipeline:
I have added the chromium dependencies to circleci as per the pupeteer instructions. Hope this is the way to go. |
69b39df
to
5a9a281
Compare
Neither |
5a9a281
to
1997a80
Compare
005d2a5
to
b090cbf
Compare
b090cbf
to
d74436c
Compare
d74436c
to
44fd457
Compare
Yay it works! 🚀 Please have another look at this PR now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Install correct typings for url-parse * Use es modules compat mode when es6 output is selected * Consolidate typescript sample generation naming scheme * Regenerate samples * Create new typescript sample to test esmodules in browser * Expose RequiredError type * Make browser integration tests pass locally * Remove cookie tests, because we don’t allow cross-origin cookies * Add output type to package definition * Execute new browser tests in pipeline * Install headless chromium dependencies in circle ci
The first try in #11298 did not work, because it broke the commonjs output.
Now I have differentiated between the two. When es6 is activated, we build an esmodule and when it is deactivated we build the classic commonjs format. For commonjs we don’t need to change our imports, because the esmodule import restrictions don’t apply to the commonjs format. For esmodule output we use a default import.
To make sure everything works, I have added a new sample that has
supportsES6
enabled. The tests for it use esbuild as bundler. (Unfortunately a bundler is needed in any case, because we include commonjs polyfills. Ideally the esmodule output could just run in the browser as-is, but that is something for another day.)As before I have included proper typings for url-parse.
I also had to expose the
RequiredError
exception type to allow explicit casting to it, because typescript regards errors incatch
asunknown
these days.Pet API tests are run against
http://localhost/v2
as base server, to prevent HSTS in the browser from forcing https.Finally, I added more fields to
package.json
that include the module type and entry point, to improve compatibility with node and bundlers, especially when generating esmodule output.PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.For Windows users, please run the script in Git BASH.
master
(5.3.0),6.0.x
@TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02)