Luca
GSAP Nuxt Module - Packages Installation Problem
@kapa.ai i decided to install
gsap@npm:@gsap/${role}
if (plus, premium, buisness) are specified in nuxt conifg as role proprierty, now i need to list all gsap club plugins (business role has all) in gsapClubPlugins object
/**
* This object contains lazy-loaded GSAP Club plugins for use in the application.
*/
const gsap[ROLE]ClubPlugins = {
//Plugins List
}
then i have to check if role is specified and by that role add it to the loop:
import { gsap } from 'gsap'
import { gsapPlugins } from './gsap-plugins'
import { defineNuxtPlugin, useRuntimeConfig } from '#app'
/**
* Register GSAP plugins only if required in module options
*/
export default defineNuxtPlugin(async (_nuxtApp) => {
const config = useRuntimeConfig().public.gsap
const role = config.role
const pluginsToRegister = config.plugins || []
for (const pluginName of pluginsToRegister as (keyof typeof gsapPlugins)[]) {
if (gsapPlugins[pluginName as keyof typeof gsapPlugins]) {
const plugin = await gsapPlugins[pluginName]()
_nuxtApp.provide(pluginName, plugin)
gsap.registerPlugin(plugin)
}
else {
throw new Error(
[gsap-nuxt-module] Plugin "${pluginName}" not found, available plugins: ${Object.keys(gsapPlugins).join(', ')})
}
}
})
55 replies
GSAP Nuxt Module - Packages Installation Problem
@kapa.ai i closed and reopened project and now i got this if i use npm run dev:prepare:
❯ npm run dev:prepare
[email protected] dev:prepare nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playgroundsh: nuxt-module-build: command not found
55 replies
GSAP Nuxt Module - Packages Installation Problem
@kapa.ai why now is asking all these packages?
ERROR Could not load @nuxt/telemetry. Is it installed? 21:07:14
at loadNuxtModuleInstance (node_modules/@nuxt/kit/dist/index.mjs:2569:9)
at installModule (node_modules/@nuxt/kit/dist/index.mjs:2480:73)
at initNuxt (node_modules/nuxt/dist/shared/nuxt.DQBGBwNc.mjs:5785:11)
at async loadNuxt (node_modules/nuxt/dist/shared/nuxt.DQBGBwNc.mjs:5988:5)
at async Module.loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:2713:19)
at async Object.run (node_modules/@nuxt/cli/dist/chunks/build.mjs:43:18)
at async runCommand (node_modules/citty/dist/index.mjs:316:16)
at async runCommand (node_modules/citty/dist/index.mjs:307:11)
at async runMain (node_modules/citty/dist/index.mjs:445:7)
ERROR Could not load @nuxt/telemetry. Is it installed?
55 replies
GSAP Nuxt Module - Packages Installation Problem
@kapa.ai Now if i run dev:build i got this error
❯ npm run dev:build
[email protected] dev:build nuxi build playgroundNuxt nuxi 21:05:27 [21:05:27] ERROR nuxi requires @nuxt/kit to be installed in your project. Try installing nuxt v3 or @nuxt/bridge first.
55 replies
GSAP Nuxt Module - Packages Installation Problem
@kapa.ai i pushed the branch if u want to check https://github.com/LucaArgentieri/gsap-nuxt-module/tree/fe/gsap-club-plugins
It seems that every time I run npm run dev:prepare the package-lock is changed and then comes the nuxt devtools error
55 replies
GSAP Nuxt Module - Packages Installation Problem
@kapa.ai The moment I do dev:prepare something breaks me:
❯ npm run dev:prepare
[email protected] dev:prepare nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playgroundℹ Stubbing gsap-nuxt-module 20:56:28 ℹ Cleaning dist directory: ./dist 20:56:28 Installing GSAP package: gsap@latest up to date, audited 2 packages in 2s found 0 vulnerabilities GSAP package installed successfully ERROR Could not load @nuxt/devtools. Is it installed? 20:56:31 at loadNuxtModuleInstance (node_modules/@nuxt/kit/dist/index.mjs:2569:9) at installModule (node_modules/@nuxt/kit/dist/index.mjs:2480:73) at initNuxt (node_modules/nuxt/dist/shared/nuxt.DQBGBwNc.mjs:5785:11) at async loadNuxt (node_modules/nuxt/dist/shared/nuxt.DQBGBwNc.mjs:5988:5) at async loadNuxt (node_modules/@nuxt/kit/dist/index.mjs:2713:19) at async Object.run (node_modules/nuxi/dist/chunks/prepare.mjs:47:18) at async runCommand$1 (node_modules/nuxi/dist/shared/nuxi.B1IlPxHz.mjs:1764:16) at async runCommand (node_modules/nuxi/dist/shared/nuxi.B1IlPxHz.mjs:3541:10) at async runCommand (node_modules/citty/dist/index.mjs:316:16) at async runCommand (node_modules/citty/dist/index.mjs:307:11) at async runMain (node_modules/citty/dist/index.mjs:445:7) ERROR Could not load @nuxt/devtools. Is it installed?
55 replies