nxext / nx-extensions

Nx Extensions for Stencil, Svelte, SolidJS, Preact, Ionic, and Capacitor
MIT License
466 stars 102 forks source link

Vite configFile is not a thing anymore (or ever was) #629

Open airtonix opened 2 years ago

airtonix commented 2 years ago

Describe the bug my apps vite.config.ts never gets used.

To Reproduce Steps to reproduce the behavior:

image

Expected behavior that things should work.

Additional context ???

airtonix commented 2 years ago

not sure what the intention of seting configFile is, I can only assume that you thought setting this would be equivilant to vite --config=./path-to-config-file.ts

Jordan-Hall commented 2 years ago

I'll take a look at this. It was meant to merge the config file. If thats not working then. we will manually read the file and merge it ourselves.

DominikPieper commented 2 years ago

@Jordan-Hall it's no problem with the config merge. I tried right now, it's again the problem with transitive deps. The open PR should fix this as well :-)

DominikPieper commented 2 years ago

@airtonix could you try the latest version? Remove the "tsconfigPaths" from your config please

airtonix commented 2 years ago

I'll try it out now

airtonix commented 2 years ago

nope, still doesn't respect my vite.config.ts ...

i have in there something like:


    build: {
      emptyOutDir: false,
      outDir: 'dist/graphiql-extension'
    }

and it refuses to write the output there instead it writes it to ../../dist/apps/graphiql-webview/

Jordan-Hall commented 2 years ago

and it refuses to write the output there instead it writes it to ../../dist/apps/graphiql-webview/

Thats working as expected. NX has a strict folder structure we are adhering too.

DominikPieper commented 2 years ago

Yes that’s the reason. Nx defines the output structure and it’s needed for various mechanisms to work like the cache

airtonix commented 2 years ago

oh well that doesn't work for vscode extensions sorry. guess I'll have to fork your project

DominikPieper commented 2 years ago

Maybe a plain Vite project is better than? If that don’t fit with the structure of Nx, maybe Nx isn’t the best tool for the job

Jordan-Hall commented 2 years ago

Agree, if you change the output, then you will loose everything but schematic for NX. You are able to change the folder structure but for NX itself... what plugin are you using and why do you need to change it.

Jordan-Hall commented 2 years ago

Reopening the ticket as more talk internally about this and see what if anything would break from NX side. Already been talks about less reliant on NX while keeping benefits such as schematics and nx cloud.

@airtonix

  1. What's the use case to change the path?
  2. Is this a global change of dist to a flat structure or per app

In the meantime you can change it via the project.json by changing the output path, before we see if it would break anything moving to vite.config

DominikPieper commented 2 years ago

@airtonix I added the possibility to set the outputDir through the project.json. It's not the vite config but through this it's more the nx dir to set something global like this. Would that work for you?