Skip to content

Commit 8e9e141

Browse files
committed
Fail more explicitly in production builds if the bundle is unusable
1 parent 5be4b31 commit 8e9e141

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/commands/start.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,8 @@ import { IS_PROD_BUILD } from '../constants';
1515

1616
function maybeBundleImport<T>(moduleName: string): T {
1717
if (IS_PROD_BUILD || process.env.OCLIF_TS_NODE === '0') {
18-
// Full package: try to explicitly load the bundle
19-
try {
20-
return require('../../bundle/' + moduleName);
21-
} catch (e) {
22-
console.log(e);
23-
// Fallback (bundle is included in real package)
24-
console.log(`Could not load bundle ${moduleName}, loading raw`);
25-
return require('../' + moduleName);
26-
}
18+
// Full built package: load the bundle
19+
return require('../../bundle/' + moduleName);
2720
} else {
2821
// Npm or dev: run the raw code
2922
return require('../' + moduleName);

0 commit comments

Comments
 (0)