timarney / react-app-rewired

Override create-react-app webpack configs without ejecting
MIT License
9.8k stars 424 forks source link

npm run build doesn't exit after successful completion #658

Open bomanimc opened 3 months ago

bomanimc commented 3 months ago

Hi all! I am noticing that the npm run build command doesn't always exit after successful completion of the build, which causes timeout failures while using this approach in CI. This is typically replicable locally (although it seems that it occasionally does exit) , but seems to be consistently replicable in CI.

Any insights on what way cause this issue?

Using react-scripts@5.0.1 and react-app-rewired@2.2.1. Scripts in package.json are set up following the documentation.

 "scripts": {
    "build": "react-app-rewired build",
    "eject": "react-scripts eject",
    "start": "react-app-rewired start",
    "test": "react-app-rewired test"
  },

It seems that the builds are completing properly, but, typically, the command doesn't exit. Here's a screenshot of the terminal output:

Screenshot 2024-07-02 at 2 04 29 PM

My config override looks something like this:

...

const override = (config, env) => {
  config.watch = env !== 'production';
  config.module.rules = [
    {
      generator: {
        filename: ({ filename }) =>
          /[\\/]favicon\.ico$/.test(filename) ? "[name][ext]" : "[hash][ext]",
      },
      test: /\.(gif|ico|jpg|mp3|otf|png|svg|riv|woff2?)$/,
      type: "asset/resource",
    },
    {
      generator: {
        filename: "[path][hash][ext][query]",
      },
      include: SRC_DIR,
      test: [
        // Keep Lottie files out of JavaScript bundles.
        /[\\/]lottie[\\/](.+)\.json$/,
        /[\\/]rive[\\/](.+)\.riv$/,
        /\.(gif|jpg|mp3|otf|png|svg|woff|woff2?)$/,
      ],
      type: "asset/resource",
    },
    {
      loader: "style-loader",
      test: /\.s?css$/,
    },
    {
      loader: "css-loader",
      test: /\.css$/,
    },

    ...

    {
      loader: "ts-loader",
      test: /\.tsx?$/,
    },
  ];
  return config;
};

module.exports = override;
camillalo commented 3 months ago

这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

bomanimc commented 2 months ago

Thank you! Looking forward to your response!