Skip to content

Commit

Permalink
chore: Update tools
Browse files Browse the repository at this point in the history
  • Loading branch information
nuintun committed May 8, 2024
1 parent 64f112d commit d5458b8
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tools/rollup.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
* @module rollup.base
*/

import { createRequire } from 'module';
import replace from '@rollup/plugin-replace';
import treeShake from './plugins/tree-shake.js';
import { createRequire, isBuiltin } from 'module';
import typescript from '@rollup/plugin-typescript';

const pkg = createRequire(import.meta.url)('../package.json');
Expand Down Expand Up @@ -58,6 +58,17 @@ export default function rollup(esnext) {
warn(error);
}
},
external: ['tslib', 'react', 'react/jsx-runtime', 'react/jsx-dev-runtime']
external(source) {
const { dependencies = {}, peerDependencies = {} } = pkg;

return (
// Built-in modules
isBuiltin(source) ||
// Dependencies modules
Reflect.has(dependencies, source) ||
// Peer dependencies modules
Reflect.has(peerDependencies, source)
);
}
};
}

0 comments on commit d5458b8

Please sign in to comment.