Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mvandoff opened this issue Oct 18, 2024 · 1 comment
Assignees

Comments

@mvandoff
Copy link

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.

@mvandoff
Copy link
Author

This is actually worse than I thought. If I make a change to a type that results in an error, ForkTsChecker wont pick up on the error even if I trigger a rebuild from the dev server in a regular file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants