diff --git a/.config/rollup.config.js b/.config/rollup.config.js index fa1d3471..308aa2ef 100644 --- a/.config/rollup.config.js +++ b/.config/rollup.config.js @@ -1,59 +1,111 @@ import cleanup from 'rollup-plugin-cleanup'; import terser from '@rollup/plugin-terser'; -export default [ - { - input: 'src/jsmind.js', - output: { +const banner = + '/**\n* @license BSD-3-Clause\n* @copyright 2014-2025 hizzgdev@163.com\n*\n* Project Home:\n* https://github.com/hizzgdev/jsmind/\n*/'; + +const cleanupPlugin = cleanup({ + comments: 'none', +}); + +const terserPlugin = terser({ + output: { + comments: 'all', + }, +}); + +// Main library configuration +const mainConfig = { + input: 'src/jsmind.js', + output: [ + // ES Module - for modern bundlers with tree-shaking support + { + file: 'es/jsmind.js', + format: 'es', + banner, + sourcemap: true, + }, + // CommonJS - for require/legacy toolchains + { + file: 'lib/jsmind.js', + format: 'cjs', + banner, + sourcemap: true, + exports: 'auto', + }, + // UMD - for direct