Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@shopware-pwa/nuxt3-module
Advanced tools
Nuxt module that allows you to set up a Nuxt 3 project with Shopware Frontends. It provides the composables and api-client packages.
If you want to use these packages with a different Vue.js framework, see the guide for using Shopware Frontends in a custom project.
Install npm package:
# Using pnpm
pnpm add -D @shopware-pwa/nuxt3-module
# Using yarn
yarn add --dev @shopware-pwa/nuxt3-module
# Using npm
npm i @shopware-pwa/nuxt3-module --save-dev
Then, register the module by editing nuxt.config.js
or (.ts
) file (by extending modules
array):
/* nuxt.config.ts */
export default defineNuxtConfig({
/* ... */
modules: [, /* ... */ "@shopware-pwa/nuxt3-module"],
// set the module config
shopware: {
// connect to your Shopware 6 API instance
endpoint: "https://demo-frontends.shopware.store",
accessToken: "SWSCBHFSNTVMAWNZDNFKSHLAYW",
},
// or directly in the runtime config
// this config will override the base one
runtimeConfig: {
public: {
shopware: {
endpoint: "https://demo-frontends.shopware.store",
accessToken: "SWSCBHFSNTVMAWNZDNFKSHLAYW",
},
},
},
});
Set up your own API instance under shopware
key or by extending public runtimeConfiguration
in the same file. The nuxt module (and vue plugin) will use those values (runtimeConfig will always override the base ones).
Now you can use any composable function you need without extra import:
<script setup>
const { login } = useUser();
const { refreshSessionContext } = useSessionContext();
refreshSessionContext();
</script>
The information about the session is kept in a cookie (sw-context-token
) and used in every request made by any composable or directly, invoked by api instance
:
<script>
const { apiClient } = useShopwareContext();
const apiResponse = await apiClient.invoke(/** params omitted */);
</script>
All composable functions are fully typed with TypeScript and they are registed globally in Nuxt.js application, so the type hinting will help you to work with all of them.
Internally, the module uses API Client and Composables packages, configured together to make everything working well. If you need to check how it's working on a different version of one of them, install a package locally in your project (to be installed and available in project's package.json
file), then the Nuxt module will use yours. Keep in mind that the different configuration may lead to unexpected behavior.
👥 Community (#shopware-frontends
& #shopware-pwa
channel)
Full changelog for stable version is available here
#871 1566f7a
Thanks @patzick! - Read more about new major release: https://github.com/shopware/frontends/discussions/965
#452 e2c225f
Thanks @patzick! - Created Nuxt layer for composables
and cms-base
. This way overriding any part of that is now possible.
#478 df96fd0
Thanks @patzick! - Dependency changes:
#742 aa97efe
Thanks @mkucmus! - Use new format of module config & deprecation warning for old config format
#664 af2bc19
Thanks @rebewp! - Changed usage of env variables to be able to adjust their naming to only include shopware once.
After merging, ENV Variables with names including SHOPWARE_SHOPWARE still work.
Updated dependencies [38a3853
, 2343012
, f1b2a30
, 2ade07a
, 1566f7a
, 823aa9b
, 4dce006
, bebae42
, 782ef4d
, 9643e56
, 1583a7a
, 97d2859
, 864616f
, d60d062
, a92941e
, 487d991
, 013a1d6
, 53e7177
, 99ad5e9
, 04ac2ad
, e2c225f
, 89a97a4
, 864616f
, 8f0b468
, 97b5949
, 05ca5b6
, 7a3a92c
, 6664aa2
, 479357c
, 6b54268
, 6b54268
]:
FAQs
Nuxt 3 module for Shopware Frontends
The npm package @shopware-pwa/nuxt3-module receives a total of 1,281 weekly downloads. As such, @shopware-pwa/nuxt3-module popularity was classified as popular.
We found that @shopware-pwa/nuxt3-module demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.