protonemedia / laravel-splade

💫 The magic of Inertia.js with the simplicity of Blade 💫 - Splade provides a super easy way to build Single Page Applications (SPA) using standard Laravel Blade templates, and sparkle it to make it interactive. All without ever leaving Blade.
https://splade.dev
MIT License
1.47k stars 111 forks source link

TypeError: laravel is not a function #421

Closed InfinityXTech closed 1 year ago

InfinityXTech commented 1 year ago

Yo guys I got this error on new splade app: NodeJS: 18.12.1

failed to load config from /home/user/vite.config.js error during build: TypeError: laravel is not a function at file:///home/user/vite.config.js.timestamp-1684257869400.mjs:7:5 at ModuleJob.run (node:internal/modules/esm/module_job:193:25) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:530:24) at async loadConfigFromBundledFile (file:///home/user/node_modules/vite/dist/node/chunks/dep-1889fec9.js:63135:21) at async loadConfigFromFile (file:///home/user/node_modules/vite/dist/node/chunks/dep-1889fec9.js:63020:28) at async resolveConfig (file:///home/user/node_modules/vite/dist/node/chunks/dep-1889fec9.js:62643:28) at async doBuild (file:///home/user/node_modules/vite/dist/node/chunks/dep-1889fec9.js:45631:20) at async build (file:///home/user/node_modules/vite/dist/node/chunks/dep-1889fec9.js:45620:16) at async CAC. (file:///home/user/node_modules/vite/dist/node/cli.js:756:9)

neatpro commented 1 year ago

Same here.

benshawuk commented 1 year ago

Having a similar problem:

failed to load config from /..../vite.config.js error during build: TypeError: laravel is not a function at file:///..../vite.config.js.timestamp-1684354007806.mjs:7:5 at ModuleJob.run (node:internal/modules/esm/module_job:193:25)

This is after trying the line:
php artisan jetstream:install --teams --api --verification

On the instructions at:
https://splade.dev/docs/jetstream
neatpro commented 1 year ago

@soixt solution from Discord worked for me:

"works when I remove "type": "module", from package.json"

pascalbaljet commented 1 year ago

Thanks for sharing. The type: module line was added in latest Laravel release: https://github.com/laravel/laravel/releases/tag/v10.2.0

I'll try to fix it asap!

benshawuk commented 1 year ago

I still get the same error when running: php artisan jetstream:install --teams --api --verification

failed to load config from /Users/myname/Documents/Coding/splade/vite.config.js error during build: TypeError: laravel is not a function at file:///Users/myname/Documents/Coding/splade/vite.config.js.timestamp-1684413716694.mjs:7:5 at ModuleJob.run (node:internal/modules/esm/module_job:193:25)

pascalbaljet commented 1 year ago

I know! I'm currently fixing Breeze and then Jetstream is next :)

benshawuk commented 1 year ago

Amazing! Thanks for your hard work. I'm looking forward to trying Splade with Jetstream! :) To be honest, Splade type "SPA" functionality should somehow be rolled into Laravel (or Livewire)'s core.

pascalbaljet commented 1 year ago

Alright, everything should be working again on fresh projects!

benshawuk commented 1 year ago

Great, thanks! I can confirm that installation works now. My only final suggestion would be to re-add the "documentation" navbar link so that we can easily see an example of how to create links to other pages, but it's all in the docs anyway. Great work! :)

pascalbaljet commented 1 year ago

Ahh yes, good idea! I'll close this issue now, thanks again for the feedback :)