diff --git a/scripts/build/package.js b/scripts/build/package.js
index 7a7a93135..0088eac93 100644
--- a/scripts/build/package.js
+++ b/scripts/build/package.js
@@ -106,18 +106,24 @@ const build = async () => {
}),
);
+ // constants used in templates to reduce package size
+ const constantsString = `const a='';`;
+
// write our generic index.js
const rawIndexJs = util.format(
indexTemplate,
+ constantsString,
buildIcons.map(iconToKeyValue).join(','),
);
await writeJs(indexFile, rawIndexJs);
// write our file containing the exports of all icons in CommonJS ...
- const rawIconsJs = `module.exports={${iconsBarrelJs.join('')}};`;
+ const rawIconsJs = `${constantsString}module.exports={${iconsBarrelJs.join(
+ '',
+ )}};`;
await writeJs(iconsJsFile, rawIconsJs);
// and ESM
- const rawIconsMjs = iconsBarrelMjs.join('');
+ const rawIconsMjs = constantsString + iconsBarrelMjs.join('');
await writeJs(iconsMjsFile, rawIconsMjs);
// and create a type declaration file
const rawIconsDts = `import {SimpleIcon} from ".";type I = SimpleIcon;${iconsBarrelDts.join(
diff --git a/scripts/build/templates/icon-object.js b/scripts/build/templates/icon-object.js
index dcd10c7a2..bccadac24 100644
--- a/scripts/build/templates/icon-object.js
+++ b/scripts/build/templates/icon-object.js
@@ -2,7 +2,7 @@
title: '%s',
slug: '%s',
get svg() {
- return '';
+ return a + '%s' + b + this.path + c;
},
path: '%s',
source: '%s',
diff --git a/scripts/build/templates/index.js b/scripts/build/templates/index.js
index 2b8c4341d..fdd470df1 100644
--- a/scripts/build/templates/index.js
+++ b/scripts/build/templates/index.js
@@ -1,5 +1,7 @@
console.warn('Deprecation warning: The `simple-icons` entrypoint will be removed in the next major. Please switch to using `import * as icons from "simple-icons/icons"` if you need an object with all the icons.')
+%s
+
var icons = {%s};
Object.defineProperty(icons, "Get", {