Skip to content

Conversation

mistercrunch
Copy link
Member

After PR #35159 changes, developers had to manually run npm run plugins:build whenever types changed in packages or plugins. This adds automatic type checking and .d.ts generation to the webpack dev process using ForkTsCheckerWebpackPlugin.

Key improvements:

  • Automatic type rebuilding when packages/plugins change
  • Inline type error reporting in webpack console
  • Incremental compilation for better performance
  • skipLibCheck optimization for faster type checking
  • Can be disabled with DISABLE_TYPE_CHECK=true npm run dev
  • Fixes PropTypes compatibility for JavaScript files

This eliminates the need for manual type rebuilding and makes the development experience smoother while maintaining type safety.

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Performance Excessive memory allocation for TypeScript checking ▹ view 🧠 Not in scope
Design Duplicate Type Definitions ▹ view 🧠 Not in scope
Performance Inefficient polling-based file watching ▹ view 🧠 Incorrect
Files scanned
File Path Reviewed
superset-frontend/src/explore/components/controls/MetricControl/savedMetricType.ts
superset-frontend/webpack.config.js

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Comment on lines +21 to +24
export type { savedMetricType } from './types';

// PropTypes definition for JavaScript files
const savedMetricTypePropTypes = PropTypes.shape({

This comment was marked as resolved.

// Watch all plugin and package source directories
ignored: ['**/node_modules', '**/.git', '**/lib', '**/esm', '**/dist'],
// Poll less frequently to reduce file handles
poll: 2000,

This comment was marked as resolved.

plugins.push(
new ForkTsCheckerWebpackPlugin({
typescript: {
memoryLimit: 8192,

This comment was marked as resolved.

…bpack

After PR #35159 changes, developers had to manually run `npm run plugins:build`
whenever types changed in packages or plugins. This adds automatic type checking
and .d.ts generation to the webpack dev process using ForkTsCheckerWebpackPlugin.

Key improvements:
- Automatic type rebuilding when packages/plugins change
- Inline type error reporting in webpack console
- Incremental compilation for better performance
- skipLibCheck optimization for faster type checking
- Can be disabled with DISABLE_TYPE_CHECK=true npm run dev
- Fixes PropTypes compatibility for JavaScript files

This eliminates the need for manual type rebuilding and makes the development
experience smoother while maintaining type safety.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
modules: [
'node_modules',
APP_DIR,
path.resolve(APP_DIR, 'packages'),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these two lines here are the key, meaning now it watches plugins/packages and rebuilds.

plugins.push(
new ForkTsCheckerWebpackPlugin({
typescript: {
memoryLimit: 8192,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need this much memory? The default seems to be 2048. This a pretty big jump

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, other places in the file we use 4096, maybe i'll stick to that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factored out a constant and using/reusing it places.

Set consistent memory limit for ForkTsCheckerWebpackPlugin across development and production builds using a TYPESCRIPT_MEMORY_LIMIT constant.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@mistercrunch
Copy link
Member Author

Everyone cool with the default of running type-checked in npm run dev? Seems like a better default to support my personal workflow and desirable for everyone else. Only reason to not default might be cpu/memory usage of that process, but I'm exposing DISABLE_TYPE_CHECK if people need that ...

@mistercrunch mistercrunch merged commit 608e3ba into master Sep 24, 2025
73 of 74 checks passed
@mistercrunch mistercrunch deleted the fix-webpack-submodules branch September 24, 2025 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants