mirror of
https://github.com/dbgate/dbgate
synced 2024-11-23 17:15:34 +00:00
20 lines
585 B
JavaScript
20 lines
585 B
JavaScript
const useBundleExternals = require('./useBundleExternals');
|
|
const getBundleExternals = require('./getBundleExternals');
|
|
|
|
function buildExternalsFromDependencies(packageJson) {
|
|
if (useBundleExternals == 'true') {
|
|
return getBundleExternals();
|
|
}
|
|
const { dependencies, optionalDependencies } = packageJson;
|
|
const externals = {};
|
|
for (let dep in dependencies || {}) {
|
|
externals[dep] = `commonjs ${dep}`;
|
|
}
|
|
for (let dep in optionalDependencies || {}) {
|
|
externals[dep] = `commonjs ${dep}`;
|
|
}
|
|
return externals;
|
|
}
|
|
|
|
module.exports = buildExternalsFromDependencies;
|