html/rollup.config.js
2025-01-07 02:57:30 +08:00

79 lines
2.2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// rollup.config.js
import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import copy from 'rollup-plugin-copy';
import { dts } from 'rollup-plugin-dts';
/**
* @type {import('rollup').RollupOptions}
*/
const config1 = {
input: 'src/index.ts', // TypeScript 入口文件
output: {
file: 'dist/html.js', // 输出文件
format: 'es', // 输出格式设置为 ES 模块
},
plugins: [
resolve({
browser: true, // 若为浏览器环境,设为 true若为 Node.js 环境,设为 false
preferBuiltins: false, // 优先使用内置模块
}), // 使用 @rollup/plugin-node-resolve 解析 node_modules 中的模块
// commonjs(), //
typescript({
allowImportingTsExtensions: true,
noEmit: true,
declaration: false,
}), // 使用 @rollup/plugin-typescript 处理 TypeScript 文件
],
include: ['node_modules/**'],
external: [],
};
const config1Dts = {
input: 'src/index.ts', // TypeScript 入口文件
output: {
file: 'dist/html.d.ts', // 输出文件
format: 'es', // 输出格式设置为 ES 模块
},
plugins: [
dts(), // 生成 .d.ts 类型声明文件
],
external: [],
include: ['node_modules/**'],
};
const effect = {
input: 'src/effect.ts', // TypeScript 入口文件
output: {
file: 'dist/effect.js', // 输出文件
format: 'es', // 输出格式设置为 ES 模块
},
plugins: [
resolve({
browser: true, // 若为浏览器环境,设为 true若为 Node.js 环境,设为 false
preferBuiltins: true, // 优先使用内置模块
}), // 使用 @rollup/plugin-node-resolve 解析 node_modules 中的模块
commonjs(), //
typescript({
allowImportingTsExtensions: true,
noEmit: true,
declaration: false,
}), // 使用 @rollup/plugin-typescript 处理 TypeScript 文件
],
};
const effectDts = {
input: 'src/effect.ts', // TypeScript 入口文件
output: {
file: 'dist/effect.d.ts', // 输出文件
format: 'es', // 输出格式设置为 ES 模块
},
plugins: [
dts(), // 生成 .d.ts 类型声明文件
],
};
export default [config1, config1Dts, effect, effectDts];