Open Keavon opened 7 months ago
I have a monorepo with this structure:
external-assets/
- asset-1.json
- asset-2.json
frontend/
src/
public/
favicon.ico
vite.config.ts
In
vite.config.ts
I have this:plugins: [DynamicPublicDirectory(["../external-assets"])]
Per default, anything in the
public
directory (likefavicon.ico
) gets served at the root likelocalhost:8080/favicon.ico
. This also means, thanks to your extension allowing me to have essentially multiplepublic
directories, I'm currently able to also accesslocalhost:8080/asset-1.json
andlocalhost:8080/asset-2.json
. However, I would prefer everything from theexternal-assets
directory by served under the/external-assets
subdirectory, like:localhost:8080/external-assets/asset-1.json
.One way that I'm not fond of is changing my monorepo directory structure like so:
external-assets/
external-assets/
asset-1.json
asset-2.json
frontend/
- ...
Proposal: change the plugin's first argument (
dirAssets
inDynamicPublicDirectory(dirAssets, mimeTypes)
) fromstring[]
to(string | { in: string, out: string })[]
so the additional asset directories can each be specified as just an input (where the files are dumped alongside thepublic
folder contents) or as an object listing both an input and output, where the latter specifies the folder(s) that contain its contents. So my use case explained above would become:plugins: [ DynamicPublicDirectory([ { in: "../external-assets", out: "external-assets" } ]) ]
Thanks for your problem!!
I would really love to see this feature @nguyenbatranvan do you have plans for adding it?
Would you be open to clarifying the licensing policy for this project to instruct users and contributors?
I would really love to see this feature @nguyenbatranvan do you have plans for adding it?
Would you be open to clarifying the licensing policy for this project to instruct users and contributors?
I will be back as soon as possible to resolve these issues
I have a monorepo with this structure:
In
vite.config.ts
I have this:Per default, anything in the
public
directory (likefavicon.ico
) gets served at the root likelocalhost:8080/favicon.ico
. This also means, thanks to your extension allowing me to have essentially multiplepublic
directories, I'm currently able to also accesslocalhost:8080/asset-1.json
andlocalhost:8080/asset-2.json
. However, I would prefer everything from theexternal-assets
directory by served under the/external-assets
subdirectory, like:localhost:8080/external-assets/asset-1.json
.One way that I'm not fond of is changing my monorepo directory structure like so:
Proposal: change the plugin's first argument (
dirAssets
inDynamicPublicDirectory(dirAssets, mimeTypes)
) fromstring[]
to(string | { in: string, out: string })[]
so the additional asset directories can each be specified as just an input (where the files are dumped alongside thepublic
folder contents) or as an object listing both an input and output, where the latter specifies the folder(s) that contain its contents. So my use case explained above would become: