This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch fix/restore-auto-dts-generation
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 2cd64e63005ab68ac4020a866dfa91ec22d23053
Author: Evan Rusackas <[email protected]>
AuthorDate: Mon Feb 23 19:10:56 2026 -0800

    fix(build): restore automatic .d.ts generation in dev mode
    
    Re-enable `build: true` and `mode: 'write-references'` on
    ForkTsCheckerWebpackPlugin so that .d.ts files are generated
    automatically during webpack dev builds. This removes the need
    for developers to manually run `npm run plugins:build`.
    
    The rootDir errors that caused #37771 to remove these settings
    are resolved by adding `configOverwrite.exclude` with story and
    test file patterns. Story files import from `@storybook-shared`
    which resolves outside plugin `rootDir: "src"`, but since the
    plugin applies `configOverwrite` per-project in --build mode,
    excluding `**/*.stories.*` prevents TypeScript from resolving
    those imports entirely.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 superset-frontend/webpack.config.js | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/superset-frontend/webpack.config.js 
b/superset-frontend/webpack.config.js
index 604fcecae4f..a10ad068ffa 100644
--- a/superset-frontend/webpack.config.js
+++ b/superset-frontend/webpack.config.js
@@ -217,24 +217,31 @@ if (!isDevMode) {
   );
 }
 
-// TypeScript type checking configuration
-// SWC handles transpilation. In production, type checking is done by:
-// 1. `npm run plugins:build` which generates .d.ts files
-// 2. `npm run type` which runs full TypeScript checking
-// We skip ForkTsCheckerWebpackPlugin in production because:
-// - Story files import from @storybook-shared which causes rootDir errors
-// - The above commands already provide comprehensive type checking
+// TypeScript type checking and .d.ts generation
+// SWC handles transpilation; this plugin handles type checking separately.
+// build: true enables project references so .d.ts files are auto-generated.
+// mode: 'write-references' writes .d.ts output (no manual `npm run 
plugins:build` needed).
+// Story files are excluded because they import @storybook-shared which 
resolves
+// outside plugin rootDir ("src"), causing errors in --build mode.
 if (isDevMode) {
   plugins.push(
     new ForkTsCheckerWebpackPlugin({
       async: true,
       typescript: {
+        build: true,
+        mode: 'write-references',
         memoryLimit: TYPESCRIPT_MEMORY_LIMIT,
         configOverwrite: {
           compilerOptions: {
             skipLibCheck: true,
             incremental: true,
           },
+          exclude: [
+            'src/**/*.js',
+            'src/**/*.jsx',
+            '**/*.test.*',
+            '**/*.stories.*',
+          ],
         },
       },
     }),

Reply via email to