4
0
forked from crowetic/commerce

index.ts broke my tree shaking

This commit is contained in:
Belen Curcio 2021-01-11 13:55:45 -03:00
parent 28b244760a
commit 8f9bbe19ca
12 changed files with 28 additions and 34 deletions

View File

@ -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'

View File

@ -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 {}

View File

@ -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,

View File

@ -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 && (

View File

@ -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 {

View File

@ -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']

View File

@ -127,7 +127,7 @@ async function getAllProducts({
}) })
} }
return { products } return { products: products.map(({ node }) => normalizeProduct(node)) }
} }
export default getAllProducts export default getAllProducts

View File

@ -111,7 +111,7 @@ async function getProduct({
setProductLocaleMeta(product) setProductLocaleMeta(product)
} }
return { product } return { product: normalizeProduct(product) }
} }
return {} return {}

View File

@ -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 {

View File

@ -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({
}, },
] ]
}, },
}) }

View File

@ -99,5 +99,8 @@
"resolutions": { "resolutions": {
"webpack": "5.11.1" "webpack": "5.11.1"
}, },
"node": {
"net": "empty"
},
"license": "MIT" "license": "MIT"
} }

View File

@ -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"]
} }