Closed kungfooman closed 10 months ago
I'm confused. PCUI is not going to be usable in any way in Node without jsdom. I mean, it has a massive reliance on the DOM.
I'm confused. PCUI is not going to be usable in any way in Node without jsdom. I mean, it has a massive reliance on the DOM.
The engine examples have code like this (In order to load the controls):
import { BindingTwoWay, LabelGroup, Panel } from '@playcanvas/pcui/react';
The examples are basically mixing UI and PC code, which IMO should be separated JS files, but that's how it evolved in engine /examples/
. Now the index.mjs
in every example dir is the Source of Truth to get a list of every example without doing "tell me every file in that folder and compare against an ignore list" (which constantly failed when I did some refactoring).
Thank you for trying to follow this :+1:
Describe the bug
Right now we cannot load
pcui
in node.To Reproduce Steps to reproduce the behavior:
npm run build
node
> await import('./dist/module/src/index.mjs')
Error:
Expected behavior
ESM modules should load, no matter what environment they are in to facilitate a wide range of use cases.
Additional context
This error is an issue for: https://github.com/playcanvas/engine/pull/5555
The ESM code is the source of truth without relying on code-duplication and "ignore lists" that fail the entire build process as soon you add another file in any of those dirs.