fixed vite error messages

This commit is contained in:
Samuel Andert 2023-07-28 12:50:30 +02:00
parent 4d310220dd
commit a4dec279dc
5 changed files with 11 additions and 9 deletions

View File

@ -1,7 +1,5 @@
<script> <script>
import { Stepper, Step } from '@skeletonlabs/skeleton'; import { Stepper, Step } from '@skeletonlabs/skeleton';
import { form, field } from 'svelte-forms';
import { required, between } from 'svelte-forms/validators';
let step = 1; let step = 1;
let name = ''; let name = '';

View File

@ -3,8 +3,12 @@ import componentNames from 'virtual:components-list';
const components = {}; const components = {};
componentNames.forEach(path => { componentNames.forEach(path => {
const name = path.split('/').pop(); // Extract just the file name from the path // Ensure imports start with ./ or ../ and end with a file extension
components[name] = () => import( /* @vite-ignore */ `/src/lib/components/${path}.svelte`); const name = path.split('/').pop(); // Extract just the file name from the path
const componentPath = `../components/${path}.svelte`; // Update the path as per your file structure
// Suppress warning for dynamic import
components[name] = () => import(/* @vite-ignore */ componentPath);
}); });
export default components; export default components;

View File

@ -7,7 +7,7 @@ export const dataStore = writable({});
// Dynamically import the data modules and assign them to the store // Dynamically import the data modules and assign them to the store
dataSources.forEach(src => { dataSources.forEach(src => {
import(`/src/lib/data/${src}.ts`).then(module => { import(/* @vite-ignore */ `../data/${src}.ts`).then(module => {
// Here, explicitly extract the required data or function from the module // Here, explicitly extract the required data or function from the module
const moduleData = module[src] || module.default; const moduleData = module[src] || module.default;

View File

@ -1,10 +1,11 @@
// servicesLoader.ts
import serviceNames from 'virtual:services-list'; import serviceNames from 'virtual:services-list';
const services: { [key: string]: Function } = {}; const services: { [key: string]: Function } = {};
serviceNames.forEach(path => { serviceNames.forEach(path => {
const serviceName = path.split('/').pop().replace('.ts', ''); const serviceName = path.split('/').pop().replace('.ts', '');
services[serviceName] = () => import(/* @vite-ignore */ `/src/lib/services/${path}`) services[serviceName] = () => import(/* @vite-ignore */ `../services/${path}.ts`)
.then(mod => { .then(mod => {
console.log(`Loaded service ${serviceName} with the following properties:`, Object.keys(mod)); console.log(`Loaded service ${serviceName} with the following properties:`, Object.keys(mod));
if (mod.default) return mod.default; if (mod.default) return mod.default;
@ -13,4 +14,3 @@ serviceNames.forEach(path => {
}); });
export default services; export default services;

View File

@ -2,8 +2,8 @@
import Composite from '$lib/core/Composite.svelte'; import Composite from '$lib/core/Composite.svelte';
let composite = { let composite = {
id: 'validationexample', id: 'test',
component: 'Form' component: 'Flows'
}; };
</script> </script>