Skip to content

Commit

Permalink
Repackage without rollup to improve tree-shaking
Browse files Browse the repository at this point in the history
  • Loading branch information
mjradwin committed Dec 8, 2024
1 parent 1d3cdec commit 4f08d8a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hebcal/rest-api",
"version": "6.0.3",
"version": "6.1.0",
"author": "Michael J. Radwin (https://github.com/mjradwin)",
"keywords": [
"hebcal"
Expand All @@ -9,14 +9,15 @@
"engines": {
"node": ">= 18.0.0"
},
"module": "./dist/index.mjs",
"module": "./dist/esm/index.js",
"typings": "dist/esm/index.d.ts",
"type": "module",
"typings": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.mjs",
"types": "./dist/index.d.ts"
}
"import": "./dist/esm/index.js",
"types": "./dist/esm/index.d.ts"
},
"./dist/esm/*": "./dist/esm/*.js"
},
"files": [
"dist"
Expand Down
19 changes: 15 additions & 4 deletions rollup.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const json = require('@rollup/plugin-json');
const terser = require('@rollup/plugin-terser');
const typescript = require('@rollup/plugin-typescript');
const pkg = require('./package.json');
const {defineConfig} = require('rollup');

const banner = '/*! ' + pkg.name + ' v' + pkg.version + ' */';

Expand All @@ -30,13 +31,23 @@ const iifeGlobals = {
'@hebcal/triennial': 'hebcal__triennial',
};

module.exports = [
const tsOptions = {rootDir: './src'};
module.exports = defineConfig([
{
input: 'src/index.ts',
output: [{file: pkg.module, format: 'es', name: pkg.name, banner}],
output: [
{
dir: 'dist/esm',
format: 'es',
preserveModules: true,
preserveModulesRoot: 'src',
name: pkg.name,
banner,
},
],
plugins: [
json({compact: true, preferConst: true}),
typescript(),
typescript({...tsOptions, outDir: 'dist/esm'}),
nodeResolve(),
commonjs(),
],
Expand Down Expand Up @@ -98,4 +109,4 @@ module.exports = [
],
external: [/@hebcal/],
},
];
]);

0 comments on commit 4f08d8a

Please sign in to comment.