Skip to content

Commit

Permalink
Add fusionrc option to override main entry point
Browse files Browse the repository at this point in the history
  • Loading branch information
pheew committed Apr 9, 2020
1 parent 853f6fd commit afa7241
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fusion-cli/build/get-webpack-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,12 @@ function getWebpackConfig(opts /*: WebpackConfigOpts */) {
legacyPkgConfig = {},
worker,
} = opts;
const main = 'src/main.js';
const main = fusionConfig.main || 'src/main.js';

if (!fs.existsSync(path.join(dir, main))) {
if(fusionConfig.main) {
throw new Error(`File configured as main entry point in .fusionrc.js '${fusionConfig.main}' could not be found in ${dir}`)
}
throw new Error(`Project directory must contain a ${main} file`);
}

Expand Down
2 changes: 2 additions & 0 deletions fusion-cli/build/load-fusionrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type FusionRC = {
zopfli?: boolean,
gzip?: boolean,
brotli?:boolean,
main?:string,
};
*/

Expand Down Expand Up @@ -72,6 +73,7 @@ function isValid(config, silent) {
'brotli',
'zopfli', // TODO: Remove redundant zopfli option
'gzip',
'main',
].includes(key)
)
) {
Expand Down

0 comments on commit afa7241

Please sign in to comment.