three.js icon indicating copy to clipboard operation
three.js copied to clipboard

Editor: Publish app as NPM package

Open ycw opened this issue 1 year ago • 1 comments

Implements: https://github.com/mrdoob/three.js/pull/28187#issuecomment-2107022036

With this PR, SETTINGS:APP:PUBLISH now emits app as NPM package with the following structure:

public/
  app.json
src/
  app.js
index.html
package.json

The package has two dependencies: three and vite, installs them via $ npm i

To play: $ npm run dev

To build: $ npm run build

To host on ghpage: adds vite.config.js to config base, ex. repo (its ghpage)

ycw avatar Jun 12 '24 08:06 ycw

I've downloaded your branch today and tested locally. It works great!

The motivation behind this PR is to produce published apps that are closer to our Installation guide. Meaning apps are using now the three npm package and host the application with a local server (in this case vite).

This should also make it easier to integrate addons like RectAreaLight or TextGeometry into published apps (see https://github.com/mrdoob/three.js/pull/28187#issuecomment-2107022036).

@mrdoob Are you fine with this new style of published apps?

Mugen87 avatar Jun 14 '24 10:06 Mugen87