Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report]: Example vite-adapter-svelte doesn't work #2074

Open
ogerfaber opened this issue Jan 26, 2025 · 0 comments
Open

[Bug Report]: Example vite-adapter-svelte doesn't work #2074

ogerfaber opened this issue Jan 26, 2025 · 0 comments

Comments

@ogerfaber
Copy link

Steps to reproduce

I'm trying to migrate a svelte app from vite to farm but I encounter some node_module import error, example:

[ Farm ] Error: Failed to build: Error: Can not load `node_modules/svelte-portal/src/Portal.svelte`. Original error:
None.

Potential Causes:
1.This kind of module is not supported, you may need plugins to support it.

Can not load `node_modules/svelte-select/Select.svelte`. Original error:
None.

Potential Causes:
1.This kind of module is not supported, you may need plugins to support it.

Can not load `node_modules/svelte-range-slider-pips/dist/svelte/components/RangeSlider.svelte`. Original error:
None.

Potential Causes:
1.This kind of module is not supported, you may need plugins to support it.

Can not resolve `leaflet` from src/component/chart/faultMap/FaultMap.svelte.
Original error: None.

Potential Causes:
1.The file that `leaflet` points to does not exist.
2.Install it first if `leaflet` is an dependency from node_modules, if you are using pnpm refer to [https://pnpm.io/faq#pnpm-does-not-work-with-your-project-here] for solutions.
3. If `leaflet` is a alias, make sure your alias config is correct.

So I decided to check how the vite-adapter-svelte example handle imports in svelte file.

But are you sure the vite-adapter-svelte still works ? Because when I fork and try to launch it, I can't:

cd examples/vite-adapter-svelte
yarn install
yarn build

output:

yarn run v1.22.19
$ farm build
[ Farm ] Using config file at /project/workspace/examples/vite-adapter-svelte/farm.config.ts
[ Farm ] Error: Failed to load config file: Cannot find package 'vite' imported from /project/workspace/examples/vite-adapter-svelte/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/index.js 

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'vite' imported from /project/workspace/examples/vite-adapter-svelte/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/index.js
    at packageResolve (node:internal/modules/esm/resolve:854:9)
    at moduleResolve (node:internal/modules/esm/resolve:927:18)
    at defaultResolve (node:internal/modules/esm/resolve:1157:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:390:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:359:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:234:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)
    at link (node:internal/modules/esm/module_job:86:36)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

If I add vite, it goes worse.

Reproduce link

No response

What is actually happening?

Can't figure out how to resolve the these node_modules imports error in Svelte

System Info

System:
    OS: macOS 14.7
    CPU: (8) arm64 Apple M1 Pro
    Memory: 432.36 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.12.0 - ~/.nvm/versions/node/v22.12.0/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.9.0 - ~/.nvm/versions/node/v22.12.0/bin/npm
    pnpm: 9.15.1 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 132.0.6834.84
    Chrome Canary: 134.0.6979.0
    Edge: 132.0.2957.115
    Safari: 18.2
  npmPackages:
    @farmfe/core: 1.6.6 => 1.6.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant