inline-critical
inline-critical copied to clipboard
Extract can't find files that are built with a public path
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.