Creating web apps via TypeScript and webpack
https://2ality.com/2020/04/webpack-typescript.html
In order to build the web app, we need to compile two sets of files into the directory build/:
- TypeScript files are stored in
ts/. - HTML files are stored in
html/.
Both tasks are handled by webpack:
-
For TypeScript, webpack starts at
main.ts, locates all TypeScript and JavaScript files that are used, and compiles them into the single script filebuild/main-bundle.js. This process is called bundling. For compiling TypeScript to JavaScript, webpack uses the loader (plugin)ts-loader. -
Copying the files in
html/is done via the webpack plugincopy-webpack-plugin.
浙公网安备 33010602011771号