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

No loader is configured for ".html" files #9932

Closed
7 tasks done
jayzun opened this issue Aug 31, 2022 · 4 comments
Closed
7 tasks done

No loader is configured for ".html" files #9932

jayzun opened this issue Aug 31, 2022 · 4 comments

Comments

@jayzun
Copy link

jayzun commented Aug 31, 2022

Describe the bug

During dependency pre-bundling, if there is a dependency which imports html files, esbuild would report an error:

No loader is configured for ".html" files: xxx.html

Reproduction

https://stackblitz.com/edit/vitejs-vite-b7dx3h?file=vite.config.js,test.html,index.html,public%2Fmain.js&terminal=dev

System Info

System:
    OS: macOS 11.3.1
    CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
    Memory: 211.95 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.20.0 - ~/.nvm/versions/node/v14.20.0/bin/node
    npm: 6.14.17 - ~/.nvm/versions/node/v14.20.0/bin/npm
  Browsers:
    Chrome: 104.0.5112.101
    Edge: 92.0.902.84
    Firefox: 103.0.2
    Safari: 14.1
  npmPackages:
    @vitejs/plugin-legacy: ^2.0.0 => 2.0.0 
    vite: ^3.0.9 => 3.0.9

Used Package Manager

npm

Logs

No response

Validations

@jayzun
Copy link
Author

jayzun commented Sep 1, 2022

anyone?👀

@jonaskuske
Copy link
Contributor

I think this is working as intended – dependencies should be shipped as valid JS code and JS doesn't allow HTML imports. So this needs to be fixed on the side of the dependency by removing the HTML import or bundling it into valid JavaScript before shipping to npm.

Which dependency is causing this? (in the repro you're adding main.js to optimizeDeps, which is not necessary)

@jayzun
Copy link
Author

jayzun commented Sep 5, 2022

I think this is working as intended – dependencies should be shipped as valid JS code and JS doesn't allow HTML imports. So this needs to be fixed on the side of the dependency by removing the HTML import or bundling it into valid JavaScript before shipping to npm.

Which dependency is causing this? (in the repro you're adding main.js to optimizeDeps, which is not necessary)

It's not an open source package, so it may not be standard enough. Since I couldn't import it in the repro, I used optimizeDeps to simulate this error.

@bluwy
Copy link
Member

bluwy commented Sep 6, 2022

Yeah this is working as intended per @jonaskuske. Vite doesn't support importing HTML in dependency prebundling, adding the library to optimizeDeps.exclude might work if you have a plugin that handles importing HTML.

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants