4
0
forked from crowetic/commerce
commerce/tsconfig.js
Tobias Koppers 1a50be125a
build performance improvements (#384)
* performance improvements

* enable incremental typechecking

* upgrade dependencies

* remove unused dependencies
2021-06-22 16:37:44 -03:00

59 lines
1.5 KiB
JavaScript

const PROVIDERS = ['bigcommerce', 'shopify', 'swell', 'vendure', 'saleor']
function getProviderName() {
return (
process.env.COMMERCE_PROVIDER ||
(process.env.BIGCOMMERCE_STOREFRONT_API_URL
? 'bigcommerce'
: process.env.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN
? 'shopify'
: process.env.NEXT_PUBLIC_SWELL_STORE_ID
? 'swell'
: 'local')
)
}
const name = getProviderName()
const EXCLUDED_PROVIDERS = PROVIDERS.filter((p) => p !== name).map(
(p) => `./framework/${p}`
)
module.exports = {
compilerOptions: {
baseUrl: '.',
target: 'esnext',
lib: ['dom', 'dom.iterable', 'esnext'],
allowJs: true,
skipLibCheck: true,
strict: true,
forceConsistentCasingInFileNames: true,
noEmit: true,
esModuleInterop: true,
module: 'esnext',
moduleResolution: 'node',
resolveJsonModule: true,
isolatedModules: true,
jsx: 'preserve',
incremental: true,
paths: {
'@lib/*': ['lib/*'],
'@utils/*': ['utils/*'],
'@config/*': ['config/*'],
'@assets/*': ['assets/*'],
'@components/*': ['components/*'],
'@commerce': ['framework/commerce'],
'@commerce/*': ['framework/commerce/*'],
// Update paths to point to the selected provider
'@framework': [`framework/${name}`],
'@framework/*': [`framework/${name}/*`],
},
},
include: ['next-env.d.ts', '**/*.d.ts', '**/*.ts', '**/*.tsx', '**/*.js'],
exclude: [
'node_modules',
// It may be useful to exclude the other providers
// from TS checking
...EXCLUDED_PROVIDERS,
],
}