with parcel (and nix flake)
There is 2 (4 if you count pnpm and yarn) way to setup.
In this approach, no linter or formatter are installed. Only parcel
.
Install all dependencies via:
npm install
then you can run the project using:
npx parcel serve index.html
or build for production using:
# for browser bundle
npx parcel build index.html --target {desktop,mobile,xr} # choose one
# build to run in nodejs (server), not browser
npx parcel build server.ts --target server
This require nix flake to be enabled. This approach will automatically install both project dependencies and all toolchains like linter, formatter, and nodejs.
TOFU: Supply all (or one of the platform) sha256 first before running any nix command.
Run this once or twice to enter the development environment.
nix develop
You can build for all target:
nix build
or specify which target to build:
nix build '.#desktop' # or '.#mobile' or '.#xr' or '.#server'
In case unexpected things happen.
rm .parcel-cache/ dist/ node_modules/ -fr
rm package-lock.json yarn.lock pnpm-lock.yaml -f