-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Scripts: Add TypeScript for builds and tests #36260
Conversation
I still need to update the documentation to reflect new capabilities added but code-wise it should be fully functional 😄 |
Size Change: 0 B Total Size: 1.08 MB ℹ️ View Unchanged
|
d41b5eb
to
57753fc
Compare
It's ready for review. |
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.
Great update 👍 This tests well and worked fine.
One question, why doesn't webpack need ts-loader
? Reading the documentation and how I implemented, I mapped the .ts
and .tsx
extensions to ts-loader
. I don't see that being done, but it still works. 🤔
Both work. You can either use the TypeScript engine directly or Babel that also supports TypeScript syntax. I figured out it’s better to follow the way we handle TypeScript in Gutenberg with Babel. https://babeljs.io/docs/en/babel-preset-typescript
|
Ah right. Babel. I was so focused on webpack and its config. I didn't look at the babel-preset config. |
Is this already available? Because I'm using the latest wp-script 19.2.2 but does not compile the ts[x] files. |
Unfortunately, we are blocked by the release process for the next major WordPress version. It won’t be published to npm until January. We need to rethink the npm publishing process now that we got blocked for more than two months |
Thank you for your answer, for now I will try to use the script from @mkaz , it's a pity to wait untill jannuary |
So, for now I just copied the webpack config file in my directory and it seems to work. As soon as it will be released I will revert to the default version. |
Description
Inspired by https://github.com/mkaz/tsblock from @mkaz:
I thought that it would be great better TypeScript support directly to the WordPress packages. This PR improves configuration to make the build work with the example block.
How has this been tested?
../node_modules/.bin/wp-scripts build
to confirm that the build works as expected.../node_modules/.bin/wp-scripts start
to confirm that the build works as expected.Screenshots
Types of changes
Checklist:
https://github.com/WordPress/gutenberg/blob/HEAD/docs/contributors/accessibility-testing.md -->