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 ".svelte" files #3

Open
NikitaZelenskis opened this issue Oct 21, 2024 · 0 comments
Open

No loader is configured for ".svelte" files #3

NikitaZelenskis opened this issue Oct 21, 2024 · 0 comments

Comments

@NikitaZelenskis
Copy link

I am not sure if this is the intended behavior, but when a Svelte component is imported and used as a variable like this, any lambda function that is build will fail to build with the following error:
No loader is configured for ".svelte" files

Example to reproduce:
src/lib/test.ts:

import AnySvelteComponent from './AnySvelteComponent.svelte'
import { type ComponentType } from 'svelte';

class MyClass {
  component: ComponentType = AnySvelteComponent;
  somethingElse: string = "mystring";
}

export const myVar = new MyClass();

src/functions/delete.ts:

import { myVar } from '$lib/test'

export async function handler(){
//do something with myVar
}
...

sst.config.ts:

...
new Cron(stack, "delete_object_stores", {
  schedule: "rate(12 hours)",
  job: {
    function: {
      handler: "src/functions/delete.handler",
    },
  },
});
...

I have currently "fixed" the issue by adding a "text" loader to all my functions. All my functions seem to be working correctly, but I am unsure whether this is the right way to fix it.
My fix example:

new Cron(stack, "delete_object_stores", {
  schedule: "rate(12 hours)",
  job: {
    function: {
      handler: "src/functions/delete.handler",
      nodejs:{
        esbuild:{
          loader: {
            ".svelte": "text",
          }
        }
      }
    },
  },
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant