You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@
8
8
9
9
- Fix JSON deserialization. #181 introduced a regression that caused TwirpScript servers' JSON serialization to fail.
10
10
- Distribute strict ESM. A CommonJS is runtime is included for legacy node clients. Code generation uses ESM and requires Node.js v14 or later.
11
+
If you're using a compiler other than TypeScript such as `webpack`, please see [these instructions](https://github.com/tatethurston/TwirpScript#webpack-setup)
11
12
- Use [ProtoScript](https://github.com/tatethurston/ProtoScript) code generation. This will result in some generated imports coming from `protoscript` instead of `twirpscript`, but this is a non breaking change. These imports were previously delegated to ProtoScript via reexports inside TwirpScript, and that indirection has now been removed.
-[Working with other tools](#working-with-other-tools)
57
57
-[Caveats, Warnings and Issues ⚠️](#caveats-warnings-and-issues-%EF%B8%8F)
58
58
-[FAQ](#faq)
59
+
-[Webpack Setup](#webpack-setup)
59
60
-[Contributing 👫](#contributing-)
60
61
-[Licensing 📃](#licensing-)
61
62
@@ -99,6 +100,7 @@ To learn more about the motivation behind Twirp (and a comparison to REST APIs a
99
100
100
101
- Node.js v16 or greater
101
102
- TypeScript v4.7 or greater when using TypeScript
103
+
-[webpack setup](#webpack-setup) when using a compiler other than TypeScript (like webpack)
102
104
103
105
## Getting Started
104
106
@@ -848,6 +850,33 @@ gRPC is great, but has a large runtime (and corresponding complexity) that is un
848
850
849
851
To learn more about the motivation behind Twirp (and a comparison to REST APIs and gRPC), check out the [announcement blog](https://blog.twitch.tv/en/2018/01/16/twirp-a-sweet-new-rpc-framework-for-go-5f2febbf35f/).
850
852
853
+
## Webpack Setup
854
+
855
+
If you're using a compiler other than TypeScript, such as webpack, this [outstanding issue in TypeScript](https://github.com/microsoft/typescript/issues/37582) adds an additional hurdle.
856
+
857
+
The short summary of the issue:
858
+
859
+
- Extensions are required for ESM imports.
860
+
- Extension-less imports have sidestepped this TypeScript issue, but extensions are required for ESM adoption.
861
+
- The TypeScript compiler requires `.js` extensions for imports.
862
+
- Compilers other than TypeScript expect `.ts` extensions for imports.
863
+
864
+
The TypeScript team is investigating [improving this issue](https://github.com/microsoft/TypeScript/issues/37582) in their [4.9 plan](https://github.com/microsoft/TypeScript/issues/50457)
865
+
866
+
Webpack users can use [extensionAlias](https://webpack.js.org/configuration/resolve/#resolveextensionalias) to solve this problem:
867
+
868
+
```diff
869
+
module.exports= {
870
+
+ resolve: {
871
+
+ extensionAlias: {
872
+
+ ".js": [".ts", ".js"],
873
+
+ },
874
+
+ },
875
+
};
876
+
```
877
+
878
+
For more context, see [TypeScript#37582](https://github.com/microsoft/typescript/issues/37582) and [Webpack#13252](https://github.com/webpack/webpack/issues/13252).
879
+
851
880
## Contributing 👫
852
881
853
882
PR's and issues welcomed! For more guidance check out [CONTRIBUTING.md](https://github.com/tatethurston/twirpscript/blob/main/CONTRIBUTING.md)
0 commit comments