forked from crowetic/commerce
index.ts broke my tree shaking
This commit is contained in:
parent
28b244760a
commit
8f9bbe19ca
@ -1,6 +1,6 @@
|
||||
import { FC, useEffect, useState, useCallback } from 'react'
|
||||
import { Logo, Button, Input } from '@components/ui'
|
||||
import { useLogin } from '@framework/auth'
|
||||
import useLogin from '@framework/auth/use-login'
|
||||
import { useUI } from '@components/ui/context'
|
||||
import { validate } from 'email-validator'
|
||||
|
||||
|
@ -3,7 +3,7 @@ import { validate } from 'email-validator'
|
||||
import { Info } from '@components/icons'
|
||||
import { useUI } from '@components/ui/context'
|
||||
import { Logo, Button, Input } from '@components/ui'
|
||||
import { useSignup } from '@framework/auth'
|
||||
import useSignup from '@framework/auth/use-signup'
|
||||
|
||||
interface Props {}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import { Avatar } from '@components/common'
|
||||
import { Moon, Sun } from '@components/icons'
|
||||
import { useUI } from '@components/ui/context'
|
||||
import ClickOutside from '@lib/click-outside'
|
||||
import { useLogout } from '@framework/auth'
|
||||
import useLogout from '@framework/auth/use-logout'
|
||||
|
||||
import {
|
||||
disableBodyScroll,
|
||||
|
@ -57,11 +57,11 @@ const ProductCard: FC<Props> = ({
|
||||
{product.price.currencyCode}
|
||||
</span>
|
||||
</div>
|
||||
<WishlistButton
|
||||
{/* <WishlistButton
|
||||
className={s.wishlistButton}
|
||||
productId={product.id}
|
||||
variant={product.variant[0]!}
|
||||
/>
|
||||
/> */}
|
||||
</div>
|
||||
<div className={s.imageContainer}>
|
||||
{product?.images && (
|
||||
|
@ -8,7 +8,7 @@ import { useUI } from '@components/ui'
|
||||
import { Swatch, ProductSlider } from '@components/product'
|
||||
import { Button, Container, Text } from '@components/ui'
|
||||
|
||||
import { usePrice } from '@framework/product'
|
||||
import usePrice from '@framework/product/use-price'
|
||||
import { useAddItem } from '@framework/cart'
|
||||
|
||||
import {
|
||||
|
@ -3,8 +3,10 @@ import cn from 'classnames'
|
||||
import { Heart } from '@components/icons'
|
||||
|
||||
import { useUI } from '@components/ui'
|
||||
import { useCustomer } from '@framework/customer'
|
||||
import { useAddItem, useWishlist, useRemoveItem } from '@framework/wishlist'
|
||||
import useCustomer from '@framework/customer/use-customer'
|
||||
import useAddItem from '@framework/wishlist/use-add-item'
|
||||
import useRemoveItem from '@framework/wishlist/use-remove-item'
|
||||
import useWishlist from '@framework/wishlist/use-add-item'
|
||||
|
||||
type Props = {
|
||||
productId: Product['id']
|
||||
|
@ -127,7 +127,7 @@ async function getAllProducts({
|
||||
})
|
||||
}
|
||||
|
||||
return { products }
|
||||
return { products: products.map(({ node }) => normalizeProduct(node)) }
|
||||
}
|
||||
|
||||
export default getAllProducts
|
||||
|
@ -111,7 +111,7 @@ async function getProduct({
|
||||
setProductLocaleMeta(product)
|
||||
}
|
||||
|
||||
return { product }
|
||||
return { product: normalizeProduct(product) }
|
||||
}
|
||||
|
||||
return {}
|
||||
|
@ -1,15 +1,14 @@
|
||||
export function normalizeProduct(productNode: any): Product {
|
||||
// console.log(productNode)
|
||||
import { Product as BCProduct } from '@framework/schema'
|
||||
|
||||
export function normalizeProduct(productNode: BCProduct): Product {
|
||||
const {
|
||||
node: {
|
||||
entityId: id,
|
||||
images,
|
||||
variants,
|
||||
productOptions,
|
||||
prices,
|
||||
path,
|
||||
...rest
|
||||
},
|
||||
entityId: id,
|
||||
images,
|
||||
variants,
|
||||
productOptions,
|
||||
prices,
|
||||
path,
|
||||
...rest
|
||||
} = productNode
|
||||
|
||||
return {
|
||||
|
@ -1,8 +1,4 @@
|
||||
const bundleAnalyzer = require('@next/bundle-analyzer')({
|
||||
enabled: !!process.env.BUNDLE_ANALYZE,
|
||||
})
|
||||
|
||||
module.exports = bundleAnalyzer({
|
||||
module.exports = {
|
||||
images: {
|
||||
domains: ['cdn11.bigcommerce.com'],
|
||||
},
|
||||
@ -38,4 +34,4 @@ module.exports = bundleAnalyzer({
|
||||
},
|
||||
]
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -99,5 +99,8 @@
|
||||
"resolutions": {
|
||||
"webpack": "5.11.1"
|
||||
},
|
||||
"node": {
|
||||
"net": "empty"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
|
@ -26,12 +26,6 @@
|
||||
"@framework": ["framework/bigcommerce"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"framework/*.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
"**/*.js"
|
||||
],
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user