Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

3.5 KB
Raw Blame
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
// Types only — the JS bundles are built by rolldown (see rolldown.config.js).
// The `.d.ts` rollup stays on tsc-backed rollup-plugin-dts: it costs ~10% of the
// build and switching generators would need `isolatedDeclarations` across the
// whole source tree, with nothing in CI comparing the emitted types.
import dts from 'rollup-plugin-dts';

export default [
    {
        input: {
            'index': 'src/index.ts',
            'index.node': 'src/index.node.ts',
            'index.wechat': 'src/index.wechat.ts',
            'index.minigame': 'src/index.minigame.ts',
            'index.native': 'src/index.native.ts',
            'physics/index': 'src/physics/index.ts',
            'physics3d/index': 'src/physics3d/index.ts',
            'douyin/index': 'src/platform/douyin/index.ts',
            'kuaishou/index': 'src/platform/kuaishou/index.ts',
            'bilibili/index': 'src/platform/bilibili/index.ts',
            'quickgame/index': 'src/platform/quickgame/index.ts',
            'alipay/index': 'src/platform/alipay/index.ts',
            'huawei/index': 'src/platform/huawei/index.ts',
            'openpaas/index': 'src/openpaas/index.ts',
            'spine/index': 'src/spine/index.ts',
            'tilemap/index': 'src/tilemap/entry.ts',
            'terrain/index': 'src/terrain/index.ts',
            'timeline/index': 'src/timeline/entry.ts',
            'fx-basic/index': 'src/postprocess/fxBasic.ts',
            'fx-atmosphere/index': 'src/postprocess/fxAtmosphere.ts',
            'fx-lighting/index': 'src/postprocess/fxLighting.ts',
            'fx-agx/index': 'src/postprocess/fxAgx.ts',
            'foliage/index': 'src/foliage/index.ts',
            'worldgen/index': 'src/worldgen/entry.ts',
            'water/index': 'src/water/index.ts',
            'spline/index': 'src/spline/index.ts',
            'image/index': 'src/image/index.ts',
            'sound/index': 'src/sound/index.ts',
            'voxel/index': 'src/voxel/index.ts',
            'rig2d/index': 'src/rig2d/entry.ts',
            'imported-scene/index': 'src/imported-scene/index.ts',
            'skeletal-animation/index': 'src/skeletal-animation/index.ts',
            'character-shaders/index': 'src/character/index.ts',
            'logic/index': 'src/logic/entry.ts',
            'debug-channel/index': 'src/debug-channel/index.ts',
            'ai/index': 'src/ai/entry.ts',
            'net/replication/index': 'src/net/replication/entry.ts',
            'net/session/index': 'src/net/session/index.ts',
            'gameplay/index': 'src/gameplay/entry.ts',
            'dragonbones/index': 'src/dragonbones/entry.ts',
            'wasm': 'src/wasm.ts',
        },
        output: {
            dir: 'dist',
            format: 'esm',
            // Several shared chunks are named after an `index` module; the second would be deduplicated to `index.d2.ts`, which is
            // not a declaration file to TypeScript. Those carry their hash instead.
            chunkFileNames: (chunk) => (chunk.name === 'index' ? 'shared/[name]-[hash].d.ts' : 'shared/[name].d.ts'),
            // Real names between chunks. Minified, every entry imported `a as Entity`
            // and a shared chunk exported `jg as UINode`, so searching the shipped
            // types for a symbol (what an agent or an IDE-less reader does) found a
            // one-line alias list instead of the declaration.
            minifyInternalExports: false,
        },
        plugins: [dts()],
    },
];