1. // webpack.config.js
    2. const path = require('path')
    3. const HtmlWebpackPlugin = require('html-webpack-plugin')
    4. module.exports = {
    5. mode: 'development',
    6. entry: './src/app.ts',
    7. output: {
    8. filename: 'app.bundle.js',
    9. path: path.resolve(__dirname, './dist'),
    10. clean: true
    11. },
    12. plugins: [
    13. new HtmlWebpackPlugin()
    14. ],
    15. module: {
    16. rules: [
    17. {
    18. test: /\.ts$/,
    19. exclude: /node_modules/,
    20. use: 'ts-loader'
    21. }
    22. ]
    23. }
    24. }
    1. // tsconfig.json
    2. // npx tsc --init
    3. "rootDir": "./src",
    4. "outDir": "./dist",

    查找、下载安装第三方库的类型声明
    https://www.typescriptlang.org/dt/search?search=