@@ -125,6 +125,36 @@ const bootstrapEntryPoints = [
125125 'out-build/bootstrap-fork.js'
126126] ;
127127
128+ /**
129+ * Task to verify React build files exist after bundling
130+ */
131+ const verifyReactFilesAfterBundleTask = task . define ( 'verify-react-files-after-bundle' , ( ) => {
132+ const fs = require ( 'fs' ) ;
133+ const path = require ( 'path' ) ;
134+ const reactOutPath = path . join ( __dirname , '../out-vscode/vs/workbench/contrib/cortexide/browser/react/out' ) ;
135+
136+ if ( ! fs . existsSync ( reactOutPath ) ) {
137+ // allow-any-unicode-next-line
138+ console . error ( `❌ React build output directory does not exist: ${ reactOutPath } ` ) ;
139+ console . error ( 'React files were not copied during bundling. This will cause a blank screen!' ) ;
140+ throw new Error ( `React build output directory does not exist: ${ reactOutPath } ` ) ;
141+ }
142+
143+ const files = fs . readdirSync ( reactOutPath ) ;
144+ const jsFiles = files . filter ( f => f . endsWith ( '.js' ) ) ;
145+
146+ if ( jsFiles . length === 0 ) {
147+ // allow-any-unicode-next-line
148+ console . error ( `❌ No React build files found in ${ reactOutPath } ` ) ;
149+ console . error ( 'React files were not copied during bundling. This will cause a blank screen!' ) ;
150+ throw new Error ( `No React build files found in ${ reactOutPath } . Expected at least one .js file.` ) ;
151+ }
152+
153+ // allow-any-unicode-next-line
154+ console . log ( `✅ Verified ${ jsFiles . length } React build files exist in out-vscode/ after bundling` ) ;
155+ return Promise . resolve ( ) ;
156+ } ) ;
157+
128158const bundleVSCodeTask = task . define ( 'bundle-vscode' , task . series (
129159 util . rimraf ( 'out-vscode' ) ,
130160 // Optimize: bundles source files automatically based on
@@ -144,15 +174,48 @@ const bundleVSCodeTask = task.define('bundle-vscode', task.series(
144174 skipTSBoilerplateRemoval : entryPoint => entryPoint === 'vs/code/electron-browser/workbench/workbench'
145175 }
146176 }
147- )
177+ ) ,
178+ verifyReactFilesAfterBundleTask // Verify React files are present after bundling
148179) ) ;
149180gulp . task ( bundleVSCodeTask ) ;
150181
151182const sourceMappingURLBase = `https://main.vscode-cdn.net/sourcemaps/${ commit } ` ;
183+
184+ /**
185+ * Task to verify React build files exist after minification
186+ */
187+ const verifyReactFilesAfterMinifyTask = task . define ( 'verify-react-files-after-minify' , ( ) => {
188+ const fs = require ( 'fs' ) ;
189+ const path = require ( 'path' ) ;
190+ const reactOutPath = path . join ( __dirname , '../out-vscode-min/vs/workbench/contrib/cortexide/browser/react/out' ) ;
191+
192+ if ( ! fs . existsSync ( reactOutPath ) ) {
193+ // allow-any-unicode-next-line
194+ console . error ( `❌ React build output directory does not exist: ${ reactOutPath } ` ) ;
195+ console . error ( 'This will cause a blank screen in the packaged app!' ) ;
196+ throw new Error ( `React build output directory does not exist: ${ reactOutPath } ` ) ;
197+ }
198+
199+ const files = fs . readdirSync ( reactOutPath ) ;
200+ const jsFiles = files . filter ( f => f . endsWith ( '.js' ) ) ;
201+
202+ if ( jsFiles . length === 0 ) {
203+ // allow-any-unicode-next-line
204+ console . error ( `❌ No React build files found in ${ reactOutPath } ` ) ;
205+ console . error ( 'This will cause a blank screen in the packaged app!' ) ;
206+ throw new Error ( `No React build files found in ${ reactOutPath } . Expected at least one .js file.` ) ;
207+ }
208+
209+ // allow-any-unicode-next-line
210+ console . log ( `✅ Verified ${ jsFiles . length } React build files exist in out-vscode-min/` ) ;
211+ return Promise . resolve ( ) ;
212+ } ) ;
213+
152214const minifyVSCodeTask = task . define ( 'minify-vscode' , task . series (
153215 bundleVSCodeTask ,
154216 util . rimraf ( 'out-vscode-min' ) ,
155- optimize . minifyTask ( 'out-vscode' , `${ sourceMappingURLBase } /core` )
217+ optimize . minifyTask ( 'out-vscode' , `${ sourceMappingURLBase } /core` ) ,
218+ verifyReactFilesAfterMinifyTask // Verify React files are present after minification
156219) ) ;
157220gulp . task ( minifyVSCodeTask ) ;
158221
0 commit comments