mirror of
https://github.com/vercel/commerce.git
synced 2025-04-24 03:47:52 +00:00
build performance improvements (#384)
* performance improvements * enable incremental typechecking * upgrade dependencies * remove unused dependencies
This commit is contained in:
parent
559451f958
commit
1a50be125a
@ -11,7 +11,7 @@ interface Props {
|
|||||||
className?: string
|
className?: string
|
||||||
product: Product
|
product: Product
|
||||||
noNameTag?: boolean
|
noNameTag?: boolean
|
||||||
imgProps?: Omit<ImageProps, 'src'>
|
imgProps?: Omit<ImageProps, 'src' | 'layout' | 'placeholder' | 'blurDataURL'>
|
||||||
variant?: 'default' | 'slim' | 'simple'
|
variant?: 'default' | 'slim' | 'simple'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import useSWR, { responseInterface } from 'swr'
|
import useSWR, { SWRResponse } from 'swr'
|
||||||
import type {
|
import type {
|
||||||
HookSWRInput,
|
HookSWRInput,
|
||||||
HookFetchInput,
|
HookFetchInput,
|
||||||
@ -11,7 +11,7 @@ import type {
|
|||||||
import defineProperty from './define-property'
|
import defineProperty from './define-property'
|
||||||
import { CommerceError } from './errors'
|
import { CommerceError } from './errors'
|
||||||
|
|
||||||
export type ResponseState<Result> = responseInterface<Result, CommerceError> & {
|
export type ResponseState<Result> = SWRResponse<Result, CommerceError> & {
|
||||||
isLoading: boolean
|
isLoading: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ const useData: UseData = (options, input, fetcherFn, swrOptions) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return response
|
return response as typeof response & { isLoading: boolean }
|
||||||
}
|
}
|
||||||
|
|
||||||
export default useData
|
export default useData
|
||||||
|
@ -12,9 +12,6 @@ const isSwell = provider === 'swell'
|
|||||||
const isVendure = provider === 'vendure'
|
const isVendure = provider === 'vendure'
|
||||||
|
|
||||||
module.exports = withCommerceConfig({
|
module.exports = withCommerceConfig({
|
||||||
future: {
|
|
||||||
webpack5: true,
|
|
||||||
},
|
|
||||||
commerce,
|
commerce,
|
||||||
i18n: {
|
i18n: {
|
||||||
locales: ['en-US', 'es'],
|
locales: ['en-US', 'es'],
|
||||||
|
11033
package-lock.json
generated
11033
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
28
package.json
28
package.json
@ -7,7 +7,7 @@
|
|||||||
"start": "next start",
|
"start": "next start",
|
||||||
"analyze": "BUNDLE_ANALYZE=both yarn build",
|
"analyze": "BUNDLE_ANALYZE=both yarn build",
|
||||||
"prettier-fix": "prettier --write .",
|
"prettier-fix": "prettier --write .",
|
||||||
"find:unused": "next-unused",
|
"find:unused": "npx next-unused",
|
||||||
"generate": "graphql-codegen",
|
"generate": "graphql-codegen",
|
||||||
"generate:shopify": "DOTENV_CONFIG_PATH=./.env.local graphql-codegen -r dotenv/config --config framework/shopify/codegen.json",
|
"generate:shopify": "DOTENV_CONFIG_PATH=./.env.local graphql-codegen -r dotenv/config --config framework/shopify/codegen.json",
|
||||||
"generate:vendure": "graphql-codegen --config framework/vendure/codegen.json",
|
"generate:vendure": "graphql-codegen --config framework/vendure/codegen.json",
|
||||||
@ -23,39 +23,35 @@
|
|||||||
"@vercel/fetch": "^6.1.0",
|
"@vercel/fetch": "^6.1.0",
|
||||||
"autoprefixer": "^10.2.6",
|
"autoprefixer": "^10.2.6",
|
||||||
"body-scroll-lock": "^3.1.5",
|
"body-scroll-lock": "^3.1.5",
|
||||||
"bowser": "^2.11.0",
|
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"cookie": "^0.4.1",
|
"cookie": "^0.4.1",
|
||||||
"dot-object": "^2.1.4",
|
|
||||||
"email-validator": "^2.0.4",
|
"email-validator": "^2.0.4",
|
||||||
"immutability-helper": "^3.1.1",
|
"immutability-helper": "^3.1.1",
|
||||||
"isomorphic-unfetch": "^3.1.0",
|
|
||||||
"js-cookie": "^2.2.1",
|
"js-cookie": "^2.2.1",
|
||||||
"keen-slider": "^5.4.1",
|
"keen-slider": "^5.4.1",
|
||||||
"lodash.debounce": "^4.0.8",
|
"lodash.debounce": "^4.0.8",
|
||||||
"lodash.random": "^3.2.0",
|
"lodash.random": "^3.2.0",
|
||||||
"lodash.throttle": "^4.1.1",
|
"lodash.throttle": "^4.1.1",
|
||||||
"next": "10.0.9-canary.5",
|
"next": "^11.0.0",
|
||||||
"next-seo": "^4.24.0",
|
"next-seo": "^4.26.0",
|
||||||
"next-themes": "^0.0.14",
|
"next-themes": "^0.0.14",
|
||||||
"postcss": "^8.3.0",
|
"postcss": "^8.3.5",
|
||||||
"postcss-nesting": "^8.0.1",
|
"postcss-nesting": "^8.0.1",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"react-fast-marquee": "^1.1.3",
|
"react-fast-marquee": "^1.1.4",
|
||||||
"react-merge-refs": "^1.1.0",
|
"react-merge-refs": "^1.1.0",
|
||||||
"react-use-measure": "^2.0.4",
|
"react-use-measure": "^2.0.4",
|
||||||
"shopify-buy": "^2.11.0",
|
|
||||||
"swell-js": "^4.0.0-next.0",
|
"swell-js": "^4.0.0-next.0",
|
||||||
"swr": "^0.5.6",
|
"swr": "^0.5.6",
|
||||||
"tabbable": "^5.2.0",
|
"tabbable": "^5.2.0",
|
||||||
"tailwindcss": "^2.1.2"
|
"tailwindcss": "^2.2.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@graphql-codegen/cli": "^1.21.5",
|
"@graphql-codegen/cli": "^1.21.5",
|
||||||
"@graphql-codegen/schema-ast": "^1.18.3",
|
"@graphql-codegen/schema-ast": "^1.18.3",
|
||||||
"@graphql-codegen/typescript": "^1.22.1",
|
"@graphql-codegen/typescript": "^1.22.2",
|
||||||
"@graphql-codegen/typescript-operations": "^1.18.0",
|
"@graphql-codegen/typescript-operations": "^1.18.1",
|
||||||
"@next/bundle-analyzer": "^10.2.3",
|
"@next/bundle-analyzer": "^10.2.3",
|
||||||
"@types/body-scroll-lock": "^2.6.1",
|
"@types/body-scroll-lock": "^2.6.1",
|
||||||
"@types/cookie": "^0.4.0",
|
"@types/cookie": "^0.4.0",
|
||||||
@ -63,18 +59,16 @@
|
|||||||
"@types/lodash.debounce": "^4.0.6",
|
"@types/lodash.debounce": "^4.0.6",
|
||||||
"@types/lodash.random": "^3.2.6",
|
"@types/lodash.random": "^3.2.6",
|
||||||
"@types/lodash.throttle": "^4.1.6",
|
"@types/lodash.throttle": "^4.1.6",
|
||||||
"@types/node": "^15.6.1",
|
"@types/node": "^15.12.4",
|
||||||
"@types/react": "^17.0.8",
|
"@types/react": "^17.0.8",
|
||||||
"@types/shopify-buy": "^2.10.5",
|
|
||||||
"deepmerge": "^4.2.2",
|
"deepmerge": "^4.2.2",
|
||||||
"graphql": "^15.5.0",
|
"graphql": "^15.5.1",
|
||||||
"husky": "^6.0.0",
|
"husky": "^6.0.0",
|
||||||
"lint-staged": "^11.0.0",
|
"lint-staged": "^11.0.0",
|
||||||
"next-unused": "^0.0.6",
|
|
||||||
"postcss-flexbugs-fixes": "^5.0.2",
|
"postcss-flexbugs-fixes": "^5.0.2",
|
||||||
"postcss-preset-env": "^6.7.0",
|
"postcss-preset-env": "^6.7.0",
|
||||||
"prettier": "^2.3.0",
|
"prettier": "^2.3.0",
|
||||||
"typescript": "4.2.4"
|
"typescript": "4.3.4"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
|
@ -34,6 +34,7 @@ module.exports = {
|
|||||||
resolveJsonModule: true,
|
resolveJsonModule: true,
|
||||||
isolatedModules: true,
|
isolatedModules: true,
|
||||||
jsx: 'preserve',
|
jsx: 'preserve',
|
||||||
|
incremental: true,
|
||||||
paths: {
|
paths: {
|
||||||
'@lib/*': ['lib/*'],
|
'@lib/*': ['lib/*'],
|
||||||
'@utils/*': ['utils/*'],
|
'@utils/*': ['utils/*'],
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
|
"incremental": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@lib/*": ["lib/*"],
|
"@lib/*": ["lib/*"],
|
||||||
"@utils/*": ["utils/*"],
|
"@utils/*": ["utils/*"],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user