-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
[vite:build-html] Unable to parse html in build step #4067
Comments
@AlonMiz this looks like an issue with vite-plugin-string, did you open an issue there first? |
@patak-js, why do you think it's on vite/packages/vite/src/node/plugins/html.ts Line 153 in 4112c5d
maybe there's a way to ignore that step somehow. Thanks |
That makes sense, if the But instead of using
And you will get the file content as a string, without internal plugins kicking in. |
@patak-js thanks but it has several downsides with that:
alternative:
|
If you get to build minimal reproduction for some of the issues (like the TS), that could be a good bug report to improve the I let other comments on possible solutions for vite not dealing with |
@patak-js it did work eventually, but we still have the caveats i mentioned
|
i was able to resolve all of the above issues.
I would still expect some better solution for
|
having a new issue. due to the addition of the
jest started to fail with unable to resolve those modules
loading a module with query params is a missing feature in jest so, I had to use this babel plugin and add it to my
so now that's the 5th issue with this raw loader. @patak-js, I wish there were a better way to achieve what I asked for 😞 |
@AlonMiz I just used the moduleNameMapper as a solution for the jest problem. I use my custom html plugin, but maybe this works for the raw plugin: moduleNameMapper: {
"^(.*).html\\?raw": `\$1.html`
} |
@svi3c this is perfect. thanks a lot! |
@dimfeld thanks alot for the submitted pr. i hope it can be merged soon
|
I am also running into this issue. I built a custom plugin that imports html files as strings (not using |
@patak-dev 's suggestion to use |
@dimfeld @rpivo Thanks a lot for that! I can report that the issue has been resolved
while webpack takes 64.92s |
…#4067) (vitejs#5342)" This reverts commit 7541a8d.
FYI, it's also related to use of experimental features. Removing I didn't take a look at it further but, I think it should be most probably same for all versions with 3.0.x . Maybe it's my bad that I missed reading it but, it's probably same for all experimental features. Here is the documentation I used before to implement advanced base options. @patak-dev. |
I have an error when building with vite, I have the following code in my |
@juanvictorbascopecastro you should wait page to be ready in that case via window.onload, document.ready, etc. |
@juanvictorbascopecastro that's because Vite merges the CSS files for code splitting by default, so the I don't think this is related to this issue though. @Niputi is there a reason you re-opened this issue? |
@bluwy sorry, don't remember. Just close it |
Describe the bug
using vite with
vite-plugin-string
for importing html as stringsdev mode works great, but when trying to build for production, we encounter the error below.
the expected behavior is to not try to traverse all of my HTMLs as I don't care if it's valid or not.
my index.html is perfectly valid but my other dozen HTML files that we import as strings are not all valid (in syntax).
Reproduction
using
vite-plugin-string
while importing broken html syntax that is not the index.htmlvite/packages/vite/src/node/plugins/html.ts
Line 153 in 4112c5d
basically should check only my index.html and not the rest of the HTML tree
System Info
Used Package Manager
yarn
Logs
Validations
The text was updated successfully, but these errors were encountered: