Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1655

@rollup/plugin-typescript TS2307: Cannot find module '../xxx/HelloWorld.svelte' or its corresponding type declarations

$
0
0

TS FILE

import App from "../xxx/HelloWorld.svelte";const app = new App({  target: document.body,});export default app;

TSCONFIG.JSON

{"extends": "@tsconfig/svelte/tsconfig.json","include": ["./**/*", ],"exclude": ["../node_modules/*"],"compilerOptions": {"strict": true, }}

ROLLUP.CONFIG.JS

import svelte from "rollup-plugin-svelte";import resolve from "@rollup/plugin-node-resolve";import commonjs from "@rollup/plugin-commonjs";import { terser } from "rollup-plugin-terser";import { sveltePreprocess } from "svelte-preprocess";import typescript from "@rollup/plugin-typescript";import path from "path";import fs from "fs";import 'svelte';const production = !process.env.ROLLUP_WATCH;export default fs  .readdirSync(path.join(__dirname, "webviews", "pages"))  .map((input) => {    const name = input.split(".")[0];    return {      input: "webviews/pages/" + input,      output: {        sourcemap: true,        format: "iife",        name: "app",        file: "out/compiled/" + name +".js",      },      plugins: [        svelte({          dev: !production,          css: (css) => {            css.write(name +".css");          },          preprocess: sveltePreprocess(),        }),        resolve({          browser: true,          dedupe: ["svelte"],        }),        commonjs(),        typescript({          tsconfig: "webviews/tsconfig.json",          sourceMap: !production,          inlineSources: !production,        }),        production && terser(),      ],      watch: {        clearScreen: false,      },    };  });

I imported typescript from "@rollup/plugin-typescript" and it cant find the .svelte file that the TS file imports for some reason.I've tried all of the solutions from previous related questions but none worked

tried downgrading to an older Typescripttried adding: "enable-ts-plugin": true to rollup.config.json file


Viewing all articles
Browse latest Browse all 1655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>