-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
scripts with a src attribute that's not a known extension aren't recognized as js #9963
Comments
Possibly related (thanks |
Since the PRs fixing the linked issue aren't merged yet, you might still be able to fool Vite by appending a query param ending with the extension, like |
Thanks @jonaskuske Now I get another error
repro: https://stackblitz.com/edit/vitejs-vite-ljh9bl?file=index.html |
Okay, remove the {
configureServer(server) {
server.middlewares.use((req, res, next) => {
if (req.url.endsWith('.imba')) {
res.setHeader('Content-Type', 'application/javascript')
}
next()
})
}
} |
@jonaskuske it works but the imba file isn't transformed. So I get this error
|
This code is guarding the transform: if (
isJSRequest(url) ||
isImportRequest(url) ||
isCSSRequest(url) ||
isHTMLProxy(url)
) {
// transform request, call plugins, ...
} Since <script type="module" src="./main.imba?import"></script> With this it works without any additional config! (besides the And as per #3828 (comment), maybe suggest adding |
It would be nice if we could read the Edit: the webkit bug for the implementation was fixed earlier this year and it ships in the Safari nightly builds, according to bugzilla: https://bugs.webkit.org/show_bug.cgi?id=204744. Also, Vite already reads @patak-dev, what do you think? |
@patak-dev Do you have an update on this issue? We're approaching a release of Imba with Vite bundling backend and front-end code and this is one of the biggest pain points we have now. 🙃 Opened a PR for |
Closing as the original issue was resolved by #10679. We still need to find a way to avoid a harcoded list of extensions, but there are other issues/PRs tracking that. |
Describe the bug
I am writing a vite plugin for Imba and it works great.
However, I cannot use
<script type="module" src="/src/main.imba"></script>
in the index.html.The browser complains about
Note that other imports work fine
Reproduction
https://stackblitz.com/edit/vitejs-vite-nxtcgv?file=vite.config.js,index.html,main.imba&terminal=dev
System Info
Used Package Manager
npm
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: