SolidJSS
SolidJSโ€ข2y agoโ€ข
8 replies
Bersaelor

Ideas what could cause static assets from failing to import?

import testImg from './test.png';

fails with
`Cannot find module './test.png' or its corresponding type declarations.

This with "solid-js": "^1.8.17", and "@solidjs/start": "^1.0.0",.

If I create a new project with npm create solid I can import the test img, trying to pinpoint what could cause my project to fail importing it.

app.config.ts:
import { defineConfig } from "@solidjs/start/config";
import suidPlugin from '@suid/vite-plugin';
import type { PluginOption } from "vite";

export default defineConfig({
  ssr: false,
  server: {
    static: true,
    preset: "static"
  },
  vite: {
    plugins: [suidPlugin() as PluginOption],
  },
});
Was this page helpful?