@@ -21,19 +21,25 @@ export const unpluginFactory: UnpluginFactory<CompilerOptions> = (args) => ({
2121 name : PLUGIN_NAME ,
2222 enforce : "pre" ,
2323 async buildStart ( ) {
24- logger . info ( "Compiling inlang project..." ) ;
24+ const isProduction = process . env . NODE_ENV === "production" ;
25+ // default to locale-modules for development to speed up the dev server
26+ // https://github.com/opral/inlang-paraglide-js/issues/486
27+ const outputStructure =
28+ args . outputStructure ??
29+ ( isProduction ? "message-modules" : "locale-modules" ) ;
2530 try {
2631 previousCompilation = await compile ( {
2732 fs : wrappedFs ,
2833 previousCompilation,
34+ outputStructure,
2935 // webpack invokes the `buildStart` api in watch mode,
3036 // to avoid cleaning the output directory in watch mode,
3137 // we only clean the output directory if there was no previous compilation
3238 cleanOutdir : previousCompilation === undefined ,
3339 isServer,
3440 ...args ,
3541 } ) ;
36- logger . success ( " Compilation complete" ) ;
42+ logger . success ( ` Compilation complete ( ${ outputStructure } )` ) ;
3743 } catch ( error ) {
3844 logger . error ( "Failed to compile project:" , ( error as Error ) . message ) ;
3945 logger . info ( "Please check your translation files for syntax errors." ) ;
@@ -50,6 +56,14 @@ export const unpluginFactory: UnpluginFactory<CompilerOptions> = (args) => ({
5056 return ;
5157 }
5258
59+ const isProduction = process . env . NODE_ENV === "production" ;
60+
61+ // default to locale-modules for development to speed up the dev server
62+ // https://github.com/opral/inlang-paraglide-js/issues/486
63+ const outputStructure =
64+ args . outputStructure ??
65+ ( isProduction ? "message-modules" : "locale-modules" ) ;
66+
5367 const previouslyReadFiles = new Set ( readFiles ) ;
5468
5569 try {
@@ -63,12 +77,13 @@ export const unpluginFactory: UnpluginFactory<CompilerOptions> = (args) => ({
6377 previousCompilation = await compile ( {
6478 fs : wrappedFs ,
6579 previousCompilation,
80+ outputStructure,
6681 cleanOutdir : false ,
6782 isServer,
6883 ...args ,
6984 } ) ;
7085
71- logger . success ( " Re-compilation complete" ) ;
86+ logger . success ( ` Re-compilation complete ( ${ outputStructure } )` ) ;
7287
7388 // Add any new files to watch
7489 for ( const filePath of Array . from ( readFiles ) ) {
@@ -99,17 +114,24 @@ export const unpluginFactory: UnpluginFactory<CompilerOptions> = (args) => ({
99114 } ;
100115
101116 compiler . hooks . beforeRun . tapPromise ( PLUGIN_NAME , async ( ) => {
117+ const isProduction = process . env . NODE_ENV === "production" ;
118+ // default to locale-modules for development to speed up the dev server
119+ // https://github.com/opral/inlang-paraglide-js/issues/486
120+ const outputStructure =
121+ args . outputStructure ??
122+ ( isProduction ? "message-modules" : "locale-modules" ) ;
102123 try {
103124 previousCompilation = await compile ( {
104125 fs : wrappedFs ,
105126 previousCompilation,
127+ outputStructure,
106128 // clean dir needs to be false. otherwise webpack get's into a race condition
107129 // of deleting the output directory and writing files at the same time for
108130 // multi environment builds
109131 cleanOutdir : false ,
110132 ...args ,
111133 } ) ;
112- logger . success ( " Compilation complete" ) ;
134+ logger . success ( ` Compilation complete ( ${ outputStructure } )` ) ;
113135 } catch ( error ) {
114136 logger . warn ( "Failed to compile project:" , ( error as Error ) . message ) ;
115137 logger . warn ( "Please check your translation files for syntax errors." ) ;
0 commit comments