@@ -66,6 +66,19 @@ function logError(message) {
6666 }
6767}
6868
69+ /**
70+ * Strip .src .js from a JavaScript file's basename
71+ *
72+ * @param {string } val The JS basename to be cleaned
73+ *
74+ * @return {string } The modified basename
75+ */
76+ function cleanJSBasename ( val ) {
77+ var val = val . replace ( '.src' , '' ) ;
78+ val = val . replace ( '.js' , '' ) ;
79+ return val ;
80+ }
81+
6982/**
7083 * Delete previously compiled files
7184 */
@@ -153,6 +166,7 @@ gulp.task(
153166 */
154167gulp . task ( 'scripts' , function ( ) {
155168 let hadError = false ;
169+ let pathMapping = { } ;
156170 return gulp
157171 . src ( config . scriptSRC )
158172 . pipe (
@@ -164,6 +178,13 @@ gulp.task('scripts', function () {
164178 } ,
165179 } )
166180 )
181+ . pipe (
182+ rename ( function ( path ) {
183+ let key = cleanJSBasename ( path . basename ) ;
184+ pathMapping [ key ] = path . dirname ;
185+ return path ;
186+ } )
187+ )
167188 . pipe (
168189 esbuild ( {
169190 bundle : true ,
@@ -175,7 +196,12 @@ gulp.task('scripts', function () {
175196 )
176197 . pipe ( lineec ( ) ) // Consistent Line Endings for non UNIX systems
177198 . pipe (
199+ // Maybe fix paths that the esbuild step clobbers?
178200 rename ( function ( path ) {
201+ let key = cleanJSBasename ( path . basename ) ;
202+ if ( pathMapping [ key ] ) {
203+ path . dirname = pathMapping [ key ] ;
204+ }
179205 if ( path . extname === '.js' ) {
180206 path . basename = path . basename . replace ( '.src' , '' ) ;
181207 }
0 commit comments