Skip to content

Commit

Permalink
chore(estimate-bytes): manage externals a bit better
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Jun 18, 2022
1 parent 8fc4f1f commit 488fe05
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions build/estimate-bytes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import filesize from 'filesize';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const root = path.join(__dirname, '../..');
const dist = path.join(root, 'ember-resources/dist');
const packageJsonPath = path.join(root, 'ember-resources/package.json');

let packageJson;

const config = {
bundles: {
Expand All @@ -28,6 +31,8 @@ const config = {
* 3. Find gzip + brotli sizes
*/
async function collectStats() {
packageJson = JSON.parse((await fs.readFile(packageJsonPath)).toString());

let { path: tmp } = await tmpDir();

let bundlePatterns = Object.keys(config.bundles);
Expand Down Expand Up @@ -83,6 +88,11 @@ async function collectStats() {
}

async function bundle(entry, outFile) {
let externals = [
...Object.keys(packageJson.dependencies || {}),
...Object.keys(packageJson.peerDependencies || {})
];

/**
* Utils are one file
*/
Expand All @@ -94,10 +104,17 @@ async function bundle(entry, outFile) {
outfile: outFile,
bundle: true,
external: [
...externals,
'ember',
'@ember/application',
'@ember/debug',
'@ember/helper',
'@ember/destroyable',
'@ember/object',
'@ember/runloop',
'@ember/test',
'@embroider/macros',
'@glimmer/component',
'@glimmer/tracking',
],
});
Expand Down

0 comments on commit 488fe05

Please sign in to comment.