3.1.0 • Published 2 months ago

@vue-storefront/nuxt v3.1.0

Weekly downloads
459
License
MIT
Repository
-
Last release
2 months ago

@vue-storefront/nuxt

Quick Setup

  1. Add @vue-storefront/nuxt dependency to your project
# Using pnpm
pnpm add -D @vue-storefront/nuxt

# Using yarn
yarn add --dev @vue-storefront/nuxt

# Using npm
npm install --save-dev @vue-storefront/nuxt
  1. Add @vue-storefront/nuxt to the modules section of nuxt.config.ts
export default defineNuxtConfig({
  modules: ["@vue-storefront/nuxt"],
});
  1. Configure the module

To configure the module, use vsf key in the Nuxt configuration object and provide necessary information such as the Middleware instance address:

export default defineNuxtConfig({
  modules: ["@vue-storefront/nuxt"],
  vsf: {
    middleware: {
      apiUrl: "http://localhost:4000"
    }
  },
});
  1. Create SDK config file - sdk.config.ts in root directory of your project:

The defineSdkConfig function is used for this purpose. The parameter for calling this function should be an anonymous function that receives an injected context from the module, containing:

  • the buildModule function,
  • the middleware URL (middlewareUrl),
  • a function for retrieving the Cookie header with cookie values (getCookieHeader).

You should import all other SDK configuration components. See the example below illustrating the SDK configuration with Unified and Contentful modules.

import {
  contentfulModule,
  ContentfulModuleType,
} from "@vsf-enterprise/contentful-sdk";
import { unifiedModule } from "@vsf-enterprise/unified-sdk";
import type { UnifiedApiExtension } from "../storefront-middleware/middleware.config";

export default defineSdkConfig(
  ({ buildModule, middlewareUrl, getCookieHeader }) => ({
    unified: buildModule(unifiedModule<UnifiedApiExtension>, {
      apiUrl: middlewareUrl + "/commerce",
      requestOptions: {
        headers: getCookieHeader,
      },
    }),
    contentful: buildModule<ContentfulModuleType>(contentfulModule, {
      apiUrl: middlewareUrl + "/cntf",
    }),
  }),
);

That's it! You can now use VueStorefront Module in your Nuxt app ✨

3.1.0

2 months ago

3.0.3

2 months ago

3.0.2

3 months ago

3.0.1

4 months ago

3.0.0

5 months ago

3.0.0-rc.2

5 months ago

3.0.0-rc.1

5 months ago

3.0.0-rc.3

5 months ago

3.0.0-rc.0

5 months ago

2.8.0

10 months ago

2.7.2

2 years ago

2.7.4

1 year ago

2.7.3

1 year ago

2.7.5

1 year ago

2.8.0-c.1

1 year ago

2.7.0

2 years ago

2.7.1

2 years ago

2.6.0

2 years ago

2.5.13

2 years ago

2.5.12-c.1

2 years ago

2.5.12-c.0

2 years ago

2.5.12

2 years ago

2.5.7

2 years ago

2.5.11

2 years ago

2.5.6

2 years ago

2.5.5

2 years ago

2.5.4

2 years ago

2.5.3

2 years ago

2.5.0

2 years ago

2.5.2

2 years ago

2.5.1

2 years ago

2.4.5

3 years ago

2.4.4

3 years ago

2.4.6

2 years ago

2.4.3

3 years ago

2.4.2

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.3.4

3 years ago

2.3.3

3 years ago

2.3.0

3 years ago

2.3.2

3 years ago

2.3.1

3 years ago

2.3.0-rc.3

3 years ago

2.3.0-rc.2

3 years ago

2.2.3

3 years ago

2.2.2

3 years ago

2.3.0-rc.1

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.1-rc.1

3 years ago

2.1.0-rc.1

3 years ago

0.0.12-lc.16

3 years ago

0.0.12-lc.15

3 years ago

0.0.12-lc.14

3 years ago

0.0.12-lc.12

3 years ago

0.0.12-lc.13

3 years ago

0.0.12-lc.10

3 years ago

0.0.12-lc.11

3 years ago

0.0.12-lc.9

3 years ago

0.0.10-lc.8

3 years ago

0.0.10-lc.7

3 years ago

0.0.12

3 years ago

0.0.10-lc.6

3 years ago

0.0.11-lc.5

3 years ago

0.0.11-lc.4

3 years ago

0.0.11-lc.3

3 years ago

0.0.11-lc.2

3 years ago

0.0.11-lc.1

3 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago