Open xko opened 1 year ago
Maybe crxjs/vite-plugin does not respect the Vite specification? The Vite documentation clearly says that buildStart
will be called once when the build starts. vite-plugin-scalajs needs this method to be called to read options and resolve sbt projects. It cannot process resolveId
before that has been done.
before I go there to create an issue, I'd like to clarify couple of things (sorry if I'd sound stupid, I'm a backend developer and this is my 1st journey JS and frontend world :)):
@sjrd , after some random attempts, I was able to make it work by doing this in scala-js plugin:
buildStart :{
sequential: true,
order: 'pre',
async handler(options) {
if (isDev === undefined)
throw new Error("configResolved must be called before buildStart");
const task = isDev ? "fastLinkJSOutput" : "fullLinkJSOutput";
const projectTask = projectID ? `${projectID}/${task}` : task;
scalaJSOutputDir = await printSbtTask(projectTask, cwd);
}
},
I don't fully understand what I have changed, but if it makes sense to you, I'll create a PR
I was trying to make a POC chrome extension using @crxjs/vite-plugin.
npm run dev
worked great (live-reloaded, catched changes in scala code etc.) , butnpm run build
failed:To reproduce:
npm i
*npm run build