framework7io / framework7

Full featured HTML framework for building iOS & Android apps
http://framework7.io
MIT License
18.06k stars 3.23k forks source link

[plugin externalize-deps] Failed to resolve entry for package "@sveltejs/vite-plugin-svelte" #4116

Closed Moanrisy closed 1 year ago

Moanrisy commented 1 year ago

Describe the bug

npm start failed after create new project using framework7 cli

To Reproduce

Steps to reproduce the behavior:

  1. Run framework7 create
  2. Choose svelte plugin
  3. npm install
  4. npm start

Expected behavior

Framework7 should run

Actual Behavior

I don't understand why vite failed. It just show this\

The plugin "externalize-deps" was triggered by this import

    vite.config.js:2:23:
      2 │ import { svelte } from '@sveltejs/vite-plugin-svelte';

Additional context

It was new project created using framework7 cli

Moanrisy commented 1 year ago

Updating vite config file with this solve the problem

import path from 'path';
//import { svelte } from '@sveltejs/vite-plugin-svelte';

const SRC_DIR = path.resolve(__dirname, './src');
const PUBLIC_DIR = path.resolve(__dirname, './public');
const BUILD_DIR = path.resolve(__dirname, './www',);

module.exports = async function() {
const { svelte } = await import('@sveltejs/vite-plugin-svelte');
  return {
    plugins: [
        svelte(),

      ],
      root: SRC_DIR,
      base: '',
      publicDir: PUBLIC_DIR,
      build: {
        outDir: BUILD_DIR,
        assetsInlineLimit: 0,
        emptyOutDir: true,
        rollupOptions: {
          treeshake: false,
        },
      },
      resolve: {
        alias: {
          '@': SRC_DIR,
        },
      },
      server: {
        host: true,
      },
  }
}
nolimits4web commented 1 year ago

Issue apparently related to Framework7-CLI, not to the framework itself