@@ -44,6 +44,7 @@ module.exports = (webpackEnv, argv) => {
4444 }
4545
4646 const isDevServerOnly = env . dev_server_only ?. toLowerCase ( ) === 'true' ;
47+ const packageJsonKey = env . package_json_key || 'visyn' ;
4748 const devtool = env . devtool ?. toLowerCase ( ) === 'false' ? false : env . devtool || ( isEnvDevelopment ? 'eval-source-map' : 'source-map' ) ;
4849 const isReactRefresh = isDevServer && isEnvDevelopment ;
4950
@@ -55,8 +56,8 @@ module.exports = (webpackEnv, argv) => {
5556 // Always look for the phovea_registry.ts in the src folder for standalone repos.
5657 const workspaceRegistryFile = path . join ( workspacePath , 'src/phovea_registry.ts' ) ;
5758
58- if ( ! appPkg . visyn ) {
59- throw Error ( `The package.json of ${ appPkg . name } does not contain a 'visyn ' entry.` ) ;
59+ if ( ! appPkg [ packageJsonKey ] ) {
60+ throw Error ( `The package.json of ${ appPkg . name } does not contain a '${ packageJsonKey } ' entry.` ) ;
6061 }
6162
6263 /**
@@ -86,7 +87,7 @@ module.exports = (webpackEnv, argv) => {
8687 // ignore if file does not exist
8788 }
8889
89- let { devServerProxy, entries, copyFiles, historyApiFallback } = appPkg . visyn ;
90+ let { bundlesFolder = 'bundles' , devServerProxy, entries, copyFiles, historyApiFallback } = appPkg [ packageJsonKey ] ;
9091
9192 if ( isDevServerOnly ) {
9293 // If we do yarn start dev_server_only=true, we only want to start the dev server and not build the app (i.e. for proxy support).
@@ -120,7 +121,7 @@ module.exports = (webpackEnv, argv) => {
120121 } ,
121122 devServer : isEnvDevelopment
122123 ? {
123- static : path . resolve ( workspacePath , 'bundles' ) ,
124+ static : path . resolve ( workspacePath , bundlesFolder ) ,
124125 compress : true ,
125126 // Explicitly set hot to true and liveReload to false to ensure that hot is preferred over liveReload
126127 hot : true ,
@@ -155,7 +156,7 @@ module.exports = (webpackEnv, argv) => {
155156 : undefined ,
156157 output : {
157158 // The build folder.
158- path : path . join ( workspacePath , 'bundles' ) ,
159+ path : path . join ( workspacePath , bundlesFolder ) ,
159160 // Add /* filename */ comments to generated require()s in the output.
160161 // TODO: rspack: pathinfo: isEnvDevelopment,
161162 // There will be one main bundle, and one file per asynchronous chunk.
@@ -414,12 +415,12 @@ module.exports = (webpackEnv, argv) => {
414415 patterns : [
415416 ...( copyFiles ?. map ( ( file ) => ( {
416417 from : path . join ( workspacePath , file ) ,
417- to : path . join ( workspacePath , 'bundles' , path . basename ( file ) ) ,
418+ to : path . join ( workspacePath , bundlesFolder , path . basename ( file ) ) ,
418419 } ) ) || [ ] ) ,
419420 ...[
420421 fs . existsSync ( workspaceMetaDataFile ) && {
421422 from : workspaceMetaDataFile ,
422- to : path . join ( workspacePath , 'bundles' , 'phoveaMetaData.json' ) ,
423+ to : path . join ( workspacePath , bundlesFolder , 'phoveaMetaData.json' ) ,
423424 // @ts -expect-error TODO: check why https://webpack.js.org/plugins/copy-webpack-plugin/#transform is not in the typing.
424425 transform : ( ) => {
425426 function resolveScreenshot ( appDirectory ) {
@@ -450,7 +451,7 @@ module.exports = (webpackEnv, argv) => {
450451 // use package-lock json as buildInfo
451452 fs . existsSync ( workspaceBuildInfoFile ) && {
452453 from : workspaceBuildInfoFile ,
453- to : path . join ( workspacePath , 'bundles' , 'buildInfo.json' ) ,
454+ to : path . join ( workspacePath , bundlesFolder , 'buildInfo.json' ) ,
454455 } ,
455456 ] . filter ( Boolean ) ,
456457 ] ,
0 commit comments