use-shopping-cart icon indicating copy to clipboard operation
use-shopping-cart copied to clipboard

Bad export of validateCartItems from use-shopping-cart/src/serverUtil in docs

Open GGAlanSmithee opened this issue 3 years ago • 4 comments

In some places in the documentation, the validateCartItems function is exported from use-shopping-cart/src/serverUtil, which does not seem to export that function. Could possibly be related to webpack config or something, but this error appears in a vanilla next.js (with TS) project.

The serverless docs pages does show the proper import though: 'use-shopping-cart/utilities'

PS. seems that the function is missing its parentheses in the docs page menu:

image

GGAlanSmithee avatar Sep 07 '21 04:09 GGAlanSmithee

@GGAlanSmithee thank you for flagging this! Gonna take a look, sorry about the confusion and errors

dayhaysoos avatar Sep 07 '21 17:09 dayhaysoos

@dayhaysoos my pleasure, thanks for this very nice package!

GGAlanSmithee avatar Sep 08 '21 04:09 GGAlanSmithee

this was an issue for me too. The documentation has been hard to follow. I located it in the utilities/serverless.js file which is fine but there's no mention of the change in the docs. I changed my require statement but I'm still getting an errorMessage "errorMessage":"Package subpath './utilities/serverless' is not defined by "exports"

not sure what to do about this

on the side note, I was really glad when you gave the serverless functions example. It was helpful.

JBusani avatar Oct 06 '21 14:10 JBusani

Hey @JBusani I had the same error message... the following import statement worked for me:

const { validateCartItems } = require("use-shopping-cart/utilities")

lars-ewers avatar Oct 08 '21 20:10 lars-ewers