fwouts / viteshot

Viteshot 📸 is a fast and simple component screenshot tool based on Vite.

Home Page:https://viteshot.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sveltekit

aubelsb2 opened this issue · comments

Is this known to work with sveltekit? I am getting module issues importing:

const {sveltekit} = require('@sveltejs/kit/vite');

using:

const playwrightShooter = require("viteshot/shooters/playwright");
const playwright = require("playwright");
const path = require("path")
const {sveltekit} = require('@sveltejs/kit/vite');
const vite = require("vite");

module.exports = {
    framework: {
        type: "svelte",
    },
    shooter: playwrightShooter(playwright.chromium),
    filePathPattern: "**/*.screenshot.@(js|jsx|tsx|vue|svelte)",
    vite: vite.defineConfig({
        resolve: {
            alias: {
                '$components': path.resolve('./src/components'),
                '$services': path.resolve("./src/services"),
                '$global': path.resolve("./src/global"),
                '$root': path.resolve("./src"),
            }
        },
        plugins: [
            sveltekit(),
        ],
    })
};

Or if I don't use that I get issues with $app

Failed to resolve import "$app/env" from "src\services\stores\user.ts". Does the file exist?
1:55:35 pm [vite] Internal server error: Failed to resolve import "$app/env" from "src\services\stores\user.ts". Does the file exist?
  Plugin: vite:import-analysis
  File: src/services/stores/user.ts
  1  |  import { writable } from "svelte/store";
  2  |  import { browser } from "$app/env";
     |                           ^
  3  |  const createWritableStore = (key, startValue) => {
  4  |    const { subscribe, set } = writable(startValue);

Hi @aubelsb2, I haven't tried it with SvelteKit.

I'm not actively working on this project at the moment but feel free to send a PR if you figure out what's missing! It might just be a few dependencies needing to be upgraded.