Closed fpolli closed 1 year ago
I got the same issue. Following the configuration in the release notes, I get the error: laravel is not function
. I don't know, is this error coming from laravel-vite-plugin
or from @sveltejs/vite-plugin-svelte
.
I added "type": "module"
to package.json:
package.json
...
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
...
Error message changed to: laravel is not function
and run npm run dev
. I hope there is a solution to this problem.
vite-plugin-svelte is no longer available as commonjs.
This has been documented in the changelog and the FAQ contains an entry about how you can keep using it in commonjs land via dynamic imports.
There have also been previous issue reports about this which are easily discovered by searching in this repo https://github.com/sveltejs/vite-plugin-svelte/issues?q=is%3Aissue+%22Failed+to+resolve+entry+for+package%22+
You also did not provide a reproduction and chose to put a useless dummy there instead.
Please try to be better at helping yourself. We are providing a lot of information and it makes me sad if people just ignore that and make me waste time writing things like this up again, which could have been spent making vite-plugin-svelte better for everyone. So please be considerate when filing bugs
Thank you for the information, which could have been provided without being a dick.
For those searching this error, it also gets triggered if you don't put type: module
in your package.json
.
For those who come here using the laravel-vite-plugin
, this is what helps, awaiting for the Laravel team to come up with ES module instead of CommonJS.
Describe the bug
failed to load config from /Users/username/Sites/sitename/vite.config.js error when starting dev server: Error: Build failed with 1 error: node_modules/esbuild/lib/main.js:1355:27: ERROR: [plugin: externalize-deps] Failed to resolve entry for package "@sveltejs/vite-plugin-svelte". The package may have incorrect main/module/exports specified in its package.json: No known conditions for "." entry in "@sveltejs/vite-plugin-svelte" package
Reproduction URL
https://stackblitz.com/edit/vitejs-vite-aupufu?file=index.html&terminal=dev
Reproduction
The Reproduction URL is a dummy. That assumes you are in svelte. My issue is the dev server won't start because it cannot resolve Svelte
My vite.config.js:
import { defineConfig } from "vite"; import laravel from "laravel-vite-plugin"; import { svelte } from '@sveltejs/vite-plugin-svelte';
export default defineConfig({ plugins: [ laravel({ input: ["resources/js/app.js"], refresh: true, valetTls: 'seeds.test' }), svelte({ / plugin options / }) ],
resolve: { alias: { 'ziggy': '/vendor/tightenco/ziggy/src/js' }, },
css: { preprocessorOptions: { scss: { additionalData: '@use "src/variables.scss" as *;', }, }, }, });
Logs
No response
System Info