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