File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ export class AssetsPlugin extends RendererComponent {
5151 }
5252
5353 if ( this . customCss ) {
54+ this . application . watchFile ( this . customCss ) ;
5455 if ( existsSync ( this . customCss ) ) {
55- this . application . watchFile ( this . customCss ) ;
5656 copySync ( this . customCss , join ( dest , "custom.css" ) ) ;
5757 } else {
5858 this . application . logger . error (
@@ -64,8 +64,8 @@ export class AssetsPlugin extends RendererComponent {
6464 }
6565
6666 if ( this . customJs ) {
67+ this . application . watchFile ( this . customJs ) ;
6768 if ( existsSync ( this . customJs ) ) {
68- this . application . watchFile ( this . customJs ) ;
6969 copySync ( this . customJs , join ( dest , "custom.js" ) ) ;
7070 } else {
7171 this . application . logger . error (
Original file line number Diff line number Diff line change @@ -92,11 +92,17 @@ export class TypeDocReader implements OptionsReader {
9292 try {
9393 if ( process . platform === "win32" ) {
9494 // Node on Windows doesn't support the `?` trick for
95- // cache-busting, so we need to use require()
95+ // cache-busting, so try using require()
9696 delete require . cache [ require . resolve ( file ) ] ;
97- const mod = require ( file ) ;
98- fileContent = mod . default ?? mod ;
99- } else {
97+ try {
98+ const mod = require ( file ) ;
99+ fileContent = mod . default ?? mod ;
100+ } catch ( error : any ) {
101+ // Only recent node can require an ESM
102+ if ( error ?. code !== "ERR_REQUIRE_ESM" ) throw error ;
103+ }
104+ }
105+ if ( ! fileContent ) {
100106 const esmPath = pathToFileURL ( file ) . toString ( ) ;
101107 // Cache-bust for reload on watch
102108 fileContent = await (
You can’t perform that action at this time.
0 commit comments