Skip to content

Commit

Permalink
Merge branch 'main' of github.com:koush/scrypted
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Sep 25, 2023
2 parents 9dd5e10 + 475b833 commit 8b7decd
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions sdk/bin/scrypted-webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ else {
out = path.resolve(cwd, 'out');

if (!entry) {
console.error('unable to locate src/main.js or src/main.ts');
return 1;
console.warn('unable to locate src/main.js or src/main.ts');
console.warn('if a custom webpack config is used, will fall back to an entry configured there');
}

var webpackCmd = path.resolve(cwd, 'node_modules/.bin/webpack-cli');
Expand Down Expand Up @@ -177,9 +177,25 @@ else {
process.env.SCRYPTED_DEFAULT_WEBPACK_CONFIG = defaultWebpackConfig;

const config = require(webpackConfig);
config.entry = {
main: entry,
};
if (entry) {
// a standard entrypoint was found
config.entry = {
main: entry,
};
} else {
// try to use an entrypoint specified in the webpack config
if (!config?.entry?.main) {
console.error("webpack config does not supply an entry file");
return 1;
}
var resolved = path.resolve(cwd, config.entry.main);
if (fs.existsSync(resolved)) {
config.entry.main = resolved
} else {
console.error("entry file specified in webpack config does not exist");
return 1;
}
}
config.output.path = out;
config.output.filename = runtime.output;

Expand Down

0 comments on commit 8b7decd

Please sign in to comment.