Skip to content
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

Build: turn on babel cache & use babel for TS building #3315

Merged
merged 5 commits into from Jul 19, 2021
Merged

Build: turn on babel cache & use babel for TS building #3315

merged 5 commits into from Jul 19, 2021

Conversation

MaikoTan
Copy link
Contributor

@MaikoTan MaikoTan commented Jul 17, 2021

  • Turn on babel cache

It is helpful to enable babel cache when in rebuilding (e.g. running webpack-dev-server), which would significantly decrease the building time.

  • Use babel for TypeScript building

Although ts-loader (tsc inside) and babel-loader (babel inside) would basically do the same thing in TypeScript transform, babel-loader removes type notations only, and doesn't do the type-checking things, so it would be faster than ts-loader (even with transpileOnly flag) in most cases. Additionally, we now need babel-loader to ensure code available always in Chrome v75 of current CEF, so why not combine them in one loader?

  • How is TypeScript type checking now

Nowadays we are using fork-ts-checker-webpack-plugin for type checking, which runs tsc in a separated process and report errors asynchronously (in production mode), that would not block webpack building (that ts-loader will).

@MaikoTan MaikoTan changed the title Build: turn on babel cache & add babel on TS building Build: turn on babel cache & use babel for TS building Jul 18, 2021
Copy link
Owner

@quisquous quisquous left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems good to me. We still have a workflow that runs tsc as well, so I'm not worried about losing testing here.

// Thanks to babel-loader, we don't need to set it as ES2019.
// But we need to set it as ES2020 to ensure mocha can run correctly.
"target": "ES2020",
"module": "ESNext",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you get out of ESNext? Mostly wondering why you're adjusting this one as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently esnext and es2020 is the same, you mean better to keep it remained?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. Yeah, I was mostly wondering why you were changing it here. I think I'd rather stick to ES2020 and then change it explicitly when we change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, done.

@quisquous quisquous merged commit 747cd32 into quisquous:main Jul 19, 2021
github-actions bot pushed a commit that referenced this pull request Jul 19, 2021
#3315)

* build: add cache in babel-loader

this helps in rebuilding in dev-server

* build: add babel-loader on ts building

* fix: mocha(nodejs) needs ES2020

* build: use babel-loader to transform ts files

* build: revert tsc target to ES2020 747cd32
github-actions bot pushed a commit that referenced this pull request Jul 19, 2021
#3315)

* build: add cache in babel-loader

this helps in rebuilding in dev-server

* build: add babel-loader on ts building

* fix: mocha(nodejs) needs ES2020

* build: use babel-loader to transform ts files

* build: revert tsc target to ES2020 747cd32
@MaikoTan MaikoTan deleted the build/babel-loader-cache branch July 19, 2021 08:39
quisquous added a commit that referenced this pull request Sep 26, 2021
This was broken in #3315 when the config files were split up.
Even though babel is used with webpack, babel is not used for
the triggers branch which is referenced directly by users
who are writing their own triggers.
quisquous added a commit that referenced this pull request Sep 26, 2021
This was broken in #3315 when the config files were split up.
Even though babel is used with webpack, babel is not used for
the triggers branch which is referenced directly by users
who are writing their own triggers.
github-actions bot pushed a commit that referenced this pull request Sep 26, 2021
This was broken in #3315 when the config files were split up.
Even though babel is used with webpack, babel is not used for
the triggers branch which is referenced directly by users
who are writing their own triggers. 2b380f5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants