Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.

Commit 9739b04

Browse files
committed
add imports
1 parent 3dd05b5 commit 9739b04

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "my-module",
2+
"name": "nuxt-lenis",
33
"version": "1.0.0",
44
"license": "MIT",
55
"type": "module",

src/module.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
defineNuxtModule,
55
addPlugin,
66
createResolver,
7+
addImports,
78
} from "@nuxt/kit";
89

910
export interface ModuleOptions {
@@ -14,15 +15,29 @@ export default defineNuxtModule<ModuleOptions>({
1415
meta: {
1516
name: "@nuxt-lenis",
1617
configKey: "nuxtLenis",
18+
compatibility: {
19+
nuxt: "^3.0.0",
20+
},
1721
},
1822
defaults: {
1923
addPlugin: true,
2024
},
21-
setup(options, nuxt) {
25+
async setup(options, nuxt) {
2226
// if (options.addPlugin) { }
2327
const { resolve } = createResolver(import.meta.url);
2428
const runtimeDir = fileURLToPath(new URL("./runtime", import.meta.url));
2529
nuxt.options.build.transpile.push(runtimeDir);
30+
31+
32+
addImports([
33+
{
34+
name: "default",
35+
as: "Lenis",
36+
from: "@studio-freight/lenis",
37+
},
38+
// { name: 'useScrollState', as: 'useScrollState', from: join(runtimeDir, 'composables') },
39+
]);
40+
2641
addPlugin(resolve(runtimeDir, "plugin"));
2742
addComponent({
2843
name: "lenis", // name of the component to be used in vue templates

src/runtime/plugin.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { defineNuxtPlugin } from "#app";
2-
import Lenis from "@studio-freight/lenis";
2+
// import Lenis from "@studio-freight/lenis";
33
import { useScrollState } from './composables/scrollState'
4+
import { Lenis } from '#imports'
45

56
export default defineNuxtPlugin((nuxtApp) => {
67
const [scrollState, setScrollState] = useScrollState();
7-
8+
89
nuxtApp.vueApp.provide("Lenis", Lenis);
910
nuxtApp.vueApp.provide("setScrollState", setScrollState);
1011
nuxtApp.vueApp.provide("scrollState", scrollState);

0 commit comments

Comments
 (0)