theatre-js / theatre

Motion design editor for the web
https://www.theatrejs.com
Apache License 2.0
10.82k stars 338 forks source link

Attempt to fix build step #471

Closed akre54 closed 4 months ago

akre54 commented 5 months ago

Attempt to fix the yarn cli build step - see #470.

It also moves the rollup.config.js file to rollup.config.mjs because rollup was complaining about import in a .js file.

This fixes the first few issues around typescript errors with esbuild, but there is still an issue when running build:ts:bundle from the root directory:

theatre 470-fix-build ✗ yarn build:ts:bundle

~/Projects/theatre/theatre/.temp/declarations/studio/src/index.d.ts → studio/dist...
[!] (plugin rpt2) RollupError: Expected ',', got '{' (Note that you need plugins to import files that are not JavaScript)
.temp/declarations/studio/src/index.d.ts (6:12)
4:  * @packageDocumentation
5:  */
6: import type { IStudio } from '@theatre/studio/TheatreStudio';
               ^
7: /**
8:  * The main instance of Studio. Read more at {@link IStudio}
RollupError: Expected ',', got '{'
    at error (~/Projects/theatre/node_modules/rollup/dist/shared/parseAst.js:279:30)
    at nodeConverters (~/Projects/theatre/node_modules/rollup/dist/shared/parseAst.js:2147:9)
    at convertNode (~/Projects/theatre/node_modules/rollup/dist/shared/parseAst.js:1032:12)
    at convertProgram (~/Projects/theatre/node_modules/rollup/dist/shared/parseAst.js:1023:48)
    at Object.parseAstAsync (~/Projects/theatre/node_modules/rollup/dist/shared/parseAst.js:2213:20)
    at Module.tryParseAsync (~/Projects/theatre/node_modules/rollup/dist/shared/rollup.js:14921:21)
    at Module.setSource (~/Projects/theatre/node_modules/rollup/dist/shared/rollup.js:14502:35)
    at ModuleLoader.addModuleSource (~/Projects/theatre/node_modules/rollup/dist/shared/rollup.js:18796:13)
vercel[bot] commented 5 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
theatre-playground ❌ Failed (Inspect) Dec 7, 2023 7:34pm
akre54 commented 5 months ago

Using rollup-plugin-dts (not the flat version) gives this error:

theatre 470-fix-build ✗ yarn build:ts:bundle

~/Projects/theatre/theatre/.temp/declarations/studio/src/index.d.ts → studio/dist...
(!) Unresolved dependencies
https://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency
@theatre/utils/types (imported by ".temp/declarations/studio/src/TheatreStudio.d.ts", ".temp/declarations/studio/src/PaneManager.d.ts", ".temp/declarations/studio/src/StudioStore/StudioStore.d.ts" and ".temp/declarations/core/src/privateAPIs.d.ts")
@theatre/sync-server/state/types (imported by ".temp/declarations/studio/src/TheatreStudio.d.ts", ".temp/declarations/studio/src/PaneManager.d.ts" and ".temp/declarations/studio/src/StudioStore/StudioStore.d.ts")
@theatre/sync-server/state/types/studio (imported by ".temp/declarations/studio/src/Studio.d.ts")
@theatre/sync-server/state/types/core (imported by ".temp/declarations/studio/src/Studio.d.ts" and ".temp/declarations/studio/src/StudioStore/StudioStore.d.ts")
@theatre/sync-server/state/schema (imported by ".temp/declarations/studio/src/StudioStore/StudioStore.d.ts")
@theatre/sync-server/trpc/routes (imported by ".temp/declarations/studio/src/SyncStore/SyncServerLink.d.ts")
[!] (plugin dts) Error: namespace child (hoisting) not supported yet

  389 |
  390 | declare namespace Prisma {
> 391 |   export import DMMF = runtime.DMMF
      |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  392 |
  393 |   export type PrismaPromise<T> = runtime.Types.Public.PrismaPromise<T>
  394 |
../packages/app/prisma/client-generated/index.d.ts
akre54 commented 5 months ago

Confirmed that, using the original rollup-plugin-dts but changing the respectExternal from true to the default false removes the error, but also gives a long list of unresolved dependencies:

(!) Unresolved dependencies
https://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency
@theatre/utils/types (imported by ".temp/declarations/studio/src/TheatreStudio.d.ts", ".temp/declarations/studio/src/StudioStore/StudioStore.d.ts", ".temp/declarations/core/src/privateAPIs.d.ts", ".temp/declarations/studio/src/PaneManager.d.ts" and ".temp/declarations/core/src/propTypes/index.d.ts")
@theatre/sync-server/state/types (imported by ".temp/declarations/studio/src/TheatreStudio.d.ts", ".temp/declarations/studio/src/StudioStore/StudioStore.d.ts" and ".temp/declarations/studio/src/PaneManager.d.ts")
@theatre/sync-server/state/types/studio (imported by ".temp/declarations/studio/src/Studio.d.ts")
@theatre/sync-server/state/types/core (imported by ".temp/declarations/studio/src/Studio.d.ts" and ".temp/declarations/studio/src/StudioStore/StudioStore.d.ts")
@theatre/sync-server/state/schema (imported by ".temp/declarations/studio/src/StudioStore/StudioStore.d.ts")
@theatre/sync-server/trpc/routes (imported by ".temp/declarations/studio/src/SyncStore/SyncServerLink.d.ts")
@theatre/utils/color (imported by ".temp/declarations/core/src/propTypes/index.d.ts")
AriaMinaei commented 4 months ago

Ah sorry for responding late. So we moved things around a bit (moved everything in theatre/* to separate packages in packages/*, among other things). Build is fixed as of 42483a2b8ea58e3a55495e5269fd37e89b62924e.

akre54 commented 4 months ago

Thanks @AriaMinaei, looking forward to trying this out.

Any news on a new version release? Appreciate all the hard work