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

Extract can't find files that are built with a public path #310

Open
steveworkman opened this issue Nov 1, 2023 · 1 comment
Open

Extract can't find files that are built with a public path #310

steveworkman opened this issue Nov 1, 2023 · 1 comment

Comments

@steveworkman
Copy link

Scenario: You have a SPA, say a VueJS one built with Vite. This app is to be deployed on a public path, say myapp so it'd be www.example.com/myapp/.

When the SPA bundle is built, its assets links are of the format /myapp/assets/main.css, but in the dist directory, the build is just dist/assets/main.css

It doesn't appear to be possible to get the extract option of inline-critical to function. https://github.com/bezoerb/inline-critical/blob/main/index.js#L165 is resolve(join(o.basePath || process.cwd, href)); which, with a basePath of "./dist" resolves to /directory/dist/myapp/assets/main.css which is incorrect.

It would be great if we could specify a publicPath option that lets inline-critical know that there's a public path parameter that it should ignore/remove when trying to locate the CSS file.

@bezoerb
Copy link
Owner

bezoerb commented Nov 1, 2023

Hey @steveworkman, thanks for creating this issue :)
Unfortunately i don't have much time at the moment but i will try to take a look at this as soon as i have some free minutes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants