rstackjs / rstackjs/rspack-dev-server

Modifying files with only types doesn't trigger rebuild. No errors thrown by fork-ts-checker-webpack-plugin.

Open
#15 1 comment 0 reactions 1 assignee View on GitHub

@LingyuCoder is already working on this.

Since Oct 22, 2024.

Dominant language
JavaScript
Stars
42
Forks
9
Avg merge
2h 12m
Merged PRs (30d)
11

Description

I'm using rspack + fork-ts-checker-webpack-plugin with a pretty simple configuration:

const isDev = true;
const isHot = true;

module.exports = {
    target: 'browserslist',
    mode: isDev ? 'development' : 'production',
    entry: path.resolve(__dirname, 'src/main.ts'),
    context: path.resolve(__dirname),
    devtool: isDev ? 'cheap-module-source-map' : false,
    output: {
        filename: isHot ? '[name].js' : '[name].[contenthash].js',
        assetModuleFilename: '[name][ext]',
        clean: true,
        scriptType: 'module',
        ...
    },
    devServer: {
        host: 'localhost',
        port: 4200,
        headers: { 'Access-Control-Allow-Origin': '*' },
        open: false,
        compress: false,
        client: {
            overlay: {
                errors: true,
                runtimeErrors: false,
                warnings: false,
            },
        },
        hot: isHot,
    },
    plugins: [
        isHot && new RefreshPlugin(),
        new ForkTsCheckerWebpackPlugin({
            typescript: {
                configFile: path.resolve(__dirname, './tsconfig.app.json'),
                mode: 'write-references',
            },
        }),
    ...
};


The problem is, if I make a change to a file that only contains type, like a .d.ts file, no rebuild will be triggered, and I assume therefore, fork-ts-checker-webpack-plugin will not know to run either. Interestingly, the browser DOES refresh when I make a change.

This contrasts with the behavior of webpack-dev-server with fork-ts-checker-webpack-plugin, which responds to all file changes.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.