Security News
OpenJS: “XZ Utils Cyberattack Likely Not an Isolated Incident”
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.
@shopware-pwa/nuxt3-module
Advanced tools
Weekly downloads
Readme
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 or use the vue3-plugin.
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"],
runtimeConfig: {
public: {
shopware: {
// connect to your Shopware 6 API instance
shopwareEndpoint: "https://demo-frontends.shopware.store",
shopwareAccessToken: "SWSCBHFSNTVMAWNZDNFKSHLAYW",
},
},
},
});
Set up your own API instance by adding public runtimeConfiguration
in the same file. The nuxt module (and vue plugin) will use this values.
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 { apiInstance } = useShopwareContext();
const rawApiResponse = await apiInstance.invokePost(/** 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
#172 4b323a14
Thanks @patzick! - Proper SSR context for requests. Logged in client have hydrated data on reload.
#204 ed35e37d
Thanks @mkucmus! - Package.json parser removed
#200 329b0aec
Thanks @mkucmus! - Internal dependency resolving
Updated dependencies [0e85ad14
, 3764736e
, 7fe30878
, e03c67a8
, 1fd1962f
, bb64070f
, 693f9829
, eddcfcca
, 8dc64e31
, eddcfcca
, 7fe30878
, 0188b36a
]:
FAQs
Nuxt 3 module for Shopware Frontends
The npm package @shopware-pwa/nuxt3-module receives a total of 2,021 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 2 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
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.
Company News
Come meet the Socket team at BSidesSF and RSA! We're sponsoring several fun networking events and we would love to see you there.
Security News
OSI is starting a conversation aimed at removing the excuse of the SaaS loophole for companies navigating licensing and the complexities of doing business with open source.