@@ -241,22 +241,23 @@ export const moveStaticPages = async ({
241
241
await writeJson ( join ( netlifyConfig . build . publish , 'static-manifest.json' ) , Object . entries ( filesManifest ) )
242
242
243
243
if ( i18n ?. defaultLocale ) {
244
+ const rootPath = basePath ? join ( netlifyConfig . build . publish , basePath ) : netlifyConfig . build . publish
244
245
// Copy the default locale into the root
245
- const defaultLocaleDir = join ( netlifyConfig . build . publish , i18n . defaultLocale )
246
+ const defaultLocaleDir = join ( rootPath , i18n . defaultLocale )
246
247
if ( existsSync ( defaultLocaleDir ) ) {
247
- await copy ( defaultLocaleDir , `${ netlifyConfig . build . publish } /` )
248
+ await copy ( defaultLocaleDir , `${ rootPath } /` )
248
249
}
249
- const defaultLocaleIndex = join ( netlifyConfig . build . publish , `${ i18n . defaultLocale } .html` )
250
- const indexHtml = join ( netlifyConfig . build . publish , 'index.html' )
250
+ const defaultLocaleIndex = join ( rootPath , `${ i18n . defaultLocale } .html` )
251
+ const indexHtml = join ( rootPath , 'index.html' )
251
252
if ( existsSync ( defaultLocaleIndex ) && ! existsSync ( indexHtml ) ) {
252
- try {
253
- await copy ( defaultLocaleIndex , indexHtml , { overwrite : false } )
254
- await copy (
255
- join ( netlifyConfig . build . publish , `${ i18n . defaultLocale } .json` ) ,
256
- join ( netlifyConfig . build . publish , 'index.json' ) ,
257
- { overwrite : false } ,
258
- )
259
- } catch { }
253
+ await copy ( defaultLocaleIndex , indexHtml , { overwrite : false } ) . catch ( ( ) => {
254
+ /* ignore */
255
+ } )
256
+ await copy ( join ( rootPath , `${ i18n . defaultLocale } .json` ) , join ( rootPath , 'index.json' ) , {
257
+ overwrite : false ,
258
+ } ) . catch ( ( ) => {
259
+ /* ignore */
260
+ } )
260
261
}
261
262
}
262
263
0 commit comments