小编apf*_*itz的帖子

Webpack watch 在第二次更改时不会生成输出

设置

我使用 Phaser.io 和 Typescript 来开发浏览器游戏。我的回购协议是这样设置的。

ts配置:

{
    "compilerOptions": {
        "target": "ES2020",
        "module": "CommonJS",
        "moduleResolution": "node",
        "sourceMap": true,
        "typeRoots": [
            "node_modules/@types",
            "node_module/phaser/types"
        ],
        "types": [
            "phaser"
        ]
    },
    "include": [
        "src/**/*"
    ],
    "exclude": [
        "node_modules"
    ]
}
Run Code Online (Sandbox Code Playgroud)

webpack.config:

const path = require('path');
const debug = process.env.NODE_ENV !== 'production';

module.exports = {
  entry: './src/js/game.ts',
  mode: debug ? 'development' : 'production',
  watchOptions: {
    ignored: /node_modules/,
  },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        use: 'ts-loader',
        exclude: /node_modules/
      }
    ]
  }, …
Run Code Online (Sandbox Code Playgroud)

typescript phaser-framework webpack

5
推荐指数
1
解决办法
852
查看次数

标签 统计

phaser-framework ×1

typescript ×1

webpack ×1