-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
docs (typescript): add guide for webpack config TS #6105
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/content/guides/typescript.mdx
Outdated
Regarding webpack configuration, instead of using Javascript for `webpack.config.js`, we could use the Typescript version `webpack.config.ts`. This is possible by installing some packages below. | ||
|
||
```bash | ||
npm install --save-dev ts-node @types/webpack |
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.
No need to install @types/webpack
, webpack v5 has built-in types
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.
That's right! I'll remove this part. I was putting it here because I ran this guide with webpack4, but I guess this always targets the latest version which is webpack5. 👍
Add a guide on how to use webpack configuration in Typescript `webpack.config.ts`. Fixes webpack#6106
Actually we did have a guide here https://webpack.js.org/configuration/configuration-languages/#typescript, so maybe we can just add a link to that in this page? |
@@ -94,6 +95,45 @@ module.exports = { | |||
|
|||
This will direct webpack to _enter_ through `./index.ts`, _load_ all `.ts` and `.tsx` files through the `ts-loader`, and _output_ a `bundle.js` file in our current directory. | |||
|
|||
Regarding webpack configuration, instead of using Javascript for `webpack.config.js`, we could use the Typescript version `webpack.config.ts`. This is possible by installing `ts-node`. | |||
|
|||
```bash |
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.
probably can have a link somewhere to link to https://webpack.js.org/configuration/configuration-languages/#typescript
which explains on using typescript for configuring webpack
Add a guide on how to use webpack configuration in Typescript
webpack.config.ts
.Fixes #6106