FriendsOfShopware / shopware-storefront-sdk

Shopware Storefront SDK
7 stars 2 forks source link

'Module not found: Error: Can't resolve' when using storage.helper #5

Closed wannevancamp closed 9 months ago

wannevancamp commented 9 months ago

Question

I'm trying to use the shopware-storefront-sdk for the first time. After running bin/build-storefront.sh the following error is thrown:

Module not found: Error: Can't resolve '@friendsofshopware/storefront-types/declare/helper/storage.helper'

Is there some configuration missing in the README.md or am I doing something wrong? This is how my extension is set up. The main goal is to use the CookieStorageHelper in both 6.5 and 6.6 so that only one version needs to be maintained.

export default class MyPlugin extends window.PluginBaseClass {

init() { if(CookieStorageHelper.getItem('cookie-name')){} }

shyim commented 9 months ago

I would recommend to use window.localStorage thats kinda what the storage helper is doing

wannevancamp commented 9 months ago

We needed the functionality of the cookie-storage.helper.js which uses document.cookie instead of window.localStorage. Anyway, we have copied the cookie-storage.helper.js to our plugin to make es_build work.

At first, I thought that the cookie-storage.helper.js helper class was included in this package, that's why I was confused. Probably this can be a useful addition when working with cookies.