momocow / webpack-userscript

A Webpack plugin for userscript projects. 🙈
https://cow.moe/webpack-userscript/
MIT License
200 stars 21 forks source link

Question: How to write userscript in TypeScript? #95

Open wilx opened 1 year ago

wilx commented 1 year ago

Is it possible to write userscripts in TypeScript? Could you please provide an example project setup for this?

momocow commented 1 year ago

Yes, it is.

Actually the TypeScript support is not directly provided by this plugin, but by webpack and ts-loader.

Here is a minimal example to build an userscript project written in TypeScript.

Run npm install and run npm run build to have a try. 😃