Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom base path for generated preview website #23

Open
arpadgabor opened this issue May 20, 2021 · 2 comments
Open

Custom base path for generated preview website #23

arpadgabor opened this issue May 20, 2021 · 2 comments
Labels
enhancement New feature or request pr welcome

Comments

@arpadgabor
Copy link

Context

I have a Nuxt project and I want to deploy the analyzer report in the same dist folder with the static generated output of Nuxt, in short, as a sub-page of my website.

Basically, I'm running nuxt generate && windicss-analysis --html dist/styles and everything is exported fine, however, the linked resources all start with a leading / so when the browser tries to load them all result in a 404 since they are not in the root folder (i.e. they are in /styles/* instead of /*).

Possible solutions

  1. Try and remove the leading / from imported resources (it seems like Storybook does this)
  2. Add another flag when exporting to specify a base path, e.g. --base-path
@antfu
Copy link
Member

antfu commented May 20, 2021

Yeah, good point. Vite already handles that and all we need to do is add another cli option --base and pass it to the Vite's config. https://vitejs.dev/config/#base

PR welcome. Thanks!

@antfu antfu added enhancement New feature or request pr welcome labels May 20, 2021
@arpadgabor
Copy link
Author

I would've submitted a PR but looking through the code I'm not sure I get how the build phase works. It looks like the package when installed is already built by vite, right? How should that option be implemented if the --html script just copies the already built package and adds the generated output?

await fs.copy(resolve(__dirname, '../dist/app'), options.outDir)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pr welcome
Projects
None yet
Development

No branches or pull requests

2 participants