Conversation
…es in package.json files
✅ Deploy Preview for tresjs-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
❌ Deploy Preview for tresjs-lab failed. Why did it fail? →
|
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the build tool for three main packages (core, cientos, postprocessing) from Vite's library mode to tsdown, streamlining the build configuration and modernizing the toolchain.
Key Changes:
- Migrated from Vite library mode to tsdown for building core, cientos, and postprocessing packages
- Removed vite-plugin-dts and vite-plugin-banner plugins in favor of tsdown's built-in functionality
- Updated package.json exports to reflect new build output structure
Reviewed Changes
Copilot reviewed 11 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Added tsdown to the catalog dependencies |
| packages/postprocessing/vite.config.ts | Removed dts and banner plugins from Vite config |
| packages/postprocessing/tsdown.config.mts | Created new tsdown configuration with banner and dts generation |
| packages/postprocessing/package.json | Updated build script and exports to use tsdown, removed require export |
| packages/core/vite.config.ts | Removed build configuration, dts, and banner plugins |
| packages/core/tsdown.config.mts | Created new tsdown configuration with multiple entry points |
| packages/core/package.json | Updated exports paths and added tsdown as dependency |
| packages/cientos/vite.config.ts | Removed build configuration, dts, and banner plugins |
| packages/cientos/tsdown.config.mts | Created new tsdown configuration with banner and dts generation |
| packages/cientos/package.json | Updated exports paths, removed main field, added tsdown dependency |
| apps/playground/package.json | Added @vitejs/plugin-vue to devDependencies |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… and package.json files
@tresjs/cientos
@tresjs/core
@tresjs/eslint-config
@tresjs/leches
@tresjs/nuxt
@tresjs/post-processing
commit: |
|
Just a note: latest rolldown version will be able to treeshake json files; in our case, TresCanvas.vue using the package.json to add the version (current version with all the package.json in the SFC); when rolldown updated, the package.json from the sfc should just use the version from the package.json |
…matic export management in tsdown.config.mts
…runtime mode resolution
|
I tried Error: Error during dependency optimization:
Build failed with 1 error:
[plugin vite:dep-pre-bundle]
Error: Package subpath './webgpu' is not defined by "exports" in C:\Projects\vue-demo\node_modules\three\package.json
at async EnvironmentPluginContainer.resolveIdmy three.js has to be pinned in v162 so I fixed it in https://github.com/Tresjs/tres/pull/1212/files#diff-ae67801fb224ca1be3bb245fa54bddc7c74638162eec2eca946f924a892b26d5 |
|
I don't think webgpu support was available on v162 |
|
I know that WebGPURenderer is first introduced in v167, but according to tres/packages/cientos/package.json Line 58 in 011a8a5 we can not break apps using v133~v166 three.js, it actually works in 5.1.0, that's why I fixed this in #1212 or check renderer.isWebGPURenderer === trueWDYT? |
✅ Deploy Preview for tresjs-lab ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…npm workspace and update package.json references
|
We still need:
|
| imports: { | ||
| transform: { | ||
| exclude: [ | ||
| /[\/]packages[\\/]cientos[\\/]dist[\\/]trescientos\.js$/, | ||
| /[\/]packages[\\/]core[\\/]dist[\\/]tres\.js$/, | ||
| /[\/]packages[\\/]leches[\\/]dist[\\/]tresleches\.js$/, | ||
| /[\/]packages[\\/]postprocessing[\\/]dist[\\/]tres-post-processing\.js$/, | ||
| ], | ||
| } | ||
| }, | ||
|
|
There was a problem hiding this comment.
Would this be necessary for anyone using the Nuxt module or just in the monorepo?
@userquin
There was a problem hiding this comment.
Just here, nuxt auto import plugin transforming these modules, resolving those files from the dist folder => on a real app those modules from nodes_modules and wont be transformed by nuxt.
Working at main branch since vite using aliases but auto import also transforming them.
There was a problem hiding this comment.
You can inspect tresleches.js at main using devtools or tres.js in this pr (just compare vite build and tsdown/rolldown build respectively).
This is the nuxt vite plugin causing the build error at apps/lab (I just exclude our dist folders to be transformed):
https://github.com/nuxt/nuxt/blob/07eccf3cb8ab7885a03e2197fd449acff4910bf0/packages/nuxt/src/imports/transform.ts#L23
…and adjust package.json references in multiple packages
…d postprocessing packages
|
Hi @userquin
I added the
Why do you think it should be a dependency? @tresjs/core is intentionally a peer dependency because @tresjs/postprocessing is an extension package, not a standalone If core were a regular dependency, users could end up with multiple versions of threejs installe,d which is a common issue. The peer dependency ensures they share a single core instance with compatible versions. Check https://github.com/pmndrs/react-postprocessing/blob/90d10d59fe5a1a86e027c1bedd36dcf3b87ddd1c/package.json#L62-L65
Yeah, I exclude this package from the migration since I depend on the
I guess the optimization would be technically correct, but the bundle impact is minimal, and if rolldown will soon handle that then it is a marginal benefit. |
…ocessing packages
|
@userquin seems that with we fixed the nuxt generate issue but now the build has a memory leak. I test it on an external project with pkg.pr.new and it doesnt have the issue |
…les from transformation
|
If we have peer dependencies for tresjs we should define all tresjs at root (and maybe inside resolutions) since pnpm can link them to npm registry instead workspace, we need to check any peer inside any workspace here resolving to the workspace. If you try to add the resolution inside the workspace package.json pnpm will complain. Maybe nx can help on this? |
|
About the memory heap error (maybe a memory leak or maybe it is huge), where is the error? If the error when buiding apps/docs or apps/lib we need more memory or reduce parallelism (not sure how to do that with nuxt, I reported a few years ago an issue when building iconify icons website). We also have some issue about memory at vueuse, it is also huge. |
@userquin So I checked whether this issue is actually present in our monorepo by running |
Because some entries using tresjs core iirc, will check it again. We need to check if tsdown inlining tres core (similar issue we have at main with threejs) |
…in pnpm-lock.yaml and nuxt.config.ts
|
NOTE: |
This PR aims to replace the main packages build tool from vite lib mode -> tsdown:
Closes #1211