-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Adapter "cannot find module" as of upgrade to recent version #3210
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
Comments
I ran a bisection and it appears that this first shows up with the upgrade to Vite 2.7 in 09e453f Edit: Tried running that reproduction with the latest Vite via |
It looks like I can work around this by doing dynamic imports inside of <script lang="ts">
import { onMount } from "svelte";
let feature;
onMount(async () => {
const Feature = (await import("ol/Feature")).default;
feature = new Feature({ value: 42 });
});
</script>
{#if feature}
<p>It worked!</p>
{/if} That's still really ugly though. Why does the tree shaking not know that the |
Edit: To sum up, it would be helpful if svelte-kit's Vite config (or maybe Vite doesn't have the option, not sure) for the server output used file extensions, per the default value of The bit about that import not really being needed at all on the server since it isn't used until |
This code is invalid:
Change it to:
If you'd like to leave off the extension then the |
It is curious that the non-spec compliant code worked in an older version of Vite. If you'd like that support to be added back, I'd recommend filing an issue there. |
Yup, I understand why that is not valid per the ES spec. However, why doesn't the rest of the tooling have an issue with it? |
No idea. The Vite folks might know better |
Similar as vitejs/vite#6193. But this is an issue within Openlayers itself, not Vite, as the error is coming from node. Since |
Describe the bug
I have an error that has cropped up in
@sveltejs/[email protected]
and@sveltejs/[email protected]
. I have a component that uses an OpenLayers map and I get the following from the adapter portion of the build:This worked as of 193/55, I first saw the error in 202/56, and still see it in 215/60. I do not think it is specific to that import, since if I remove it, it just complains about another file from OpenLayers instead.
<monorepo_project>/node_modules/ol/Feature.js
exists, so I do not know why it is having trouble finding that.I should note that
npm run dev
works fine and does not complain about anythingReproduction
See minimal reproduction at https://github.com./wallw-bits/svelte-kit-ol-issue-repro and
npm i
followed bynpm run build
.Logs
No response
System Info
Severity
blocking an upgrade
Additional Information
No response
The text was updated successfully, but these errors were encountered: