Perfect timing! I just had a question on this and your article solved the problem I had! I tried and it works beautifully!
Just a couple of minor improvements:
- The build script can be made a simple executable by adding
!/usr/bin/env node as the first line and then running chmod +x build.js
- After this the
scripts section in package.json can be updated to run this script when npm run build is called:"scripts": {
"start": "vite",
"dev": "vite",
"build": "./build.js",
"serve": "vite preview"
},
For typescript, I found that I simply needed to change the entryPoints value to entryPoints: ["src/index.tsx"],.
Perfect timing! I just had a question on this and your article solved the problem I had! I tried and it works beautifully!
Just a couple of minor improvements:
!/usr/bin/env nodeas the first line and then runningchmod +x build.jsscriptssection inpackage.jsoncan be updated to run this script whennpm run buildis called:"scripts": { "start": "vite", "dev": "vite", "build": "./build.js", "serve": "vite preview" },For typescript, I found that I simply needed to change the
entryPointsvalue toentryPoints: ["src/index.tsx"],.