mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 23:46:58 +00:00
Updated imports in site
This commit is contained in:
parent
678825d782
commit
59b8f6d78d
4
package-lock.json
generated
4
package-lock.json
generated
@ -7998,8 +7998,8 @@
|
||||
"@types/node": "^15.12.4",
|
||||
"@types/react": "^17.0.8",
|
||||
"@vercel/fetch": "^6.1.1",
|
||||
"deepmerge": "*",
|
||||
"import-cwd": "*",
|
||||
"deepmerge": "^4.2.2",
|
||||
"import-cwd": "^3.0.0",
|
||||
"js-cookie": "^2.2.1",
|
||||
"next": "^12.0.3",
|
||||
"react": "^17.0.2",
|
||||
|
@ -9,6 +9,7 @@
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./*": "./dist/*.js",
|
||||
"./config": "./dist/config.cjs"
|
||||
},
|
||||
|
@ -15,7 +15,7 @@
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"pretty": true,
|
||||
"jsx": "preserve"
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
|
@ -9,6 +9,7 @@
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./*": "./dist/*.js",
|
||||
"./next.config": "./dist/next.config.cjs"
|
||||
},
|
||||
|
@ -15,7 +15,7 @@
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"pretty": true,
|
||||
"jsx": "preserve"
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
|
@ -42,8 +42,6 @@ function withCommerceConfig(nextConfig = {}) {
|
||||
const { commerce } = config
|
||||
const { provider } = commerce
|
||||
|
||||
console.log('CONFIG', config)
|
||||
|
||||
if (!provider) {
|
||||
throw new Error(
|
||||
`The commerce provider is missing, please add a valid provider name or its environment variables`
|
||||
@ -64,9 +62,19 @@ function withCommerceConfig(nextConfig = {}) {
|
||||
commerce.tsconfigPath || 'tsconfig.json'
|
||||
)
|
||||
const tsconfig = require(tsconfigPath)
|
||||
// The module path is a symlink in node_modules
|
||||
// -> /node_modules/[name]/dist/index.js
|
||||
const absolutePath = require.resolve(provider)
|
||||
// but we want references to go to the real path in /packages instead
|
||||
// -> packages/[name]/dist/index.js
|
||||
const relativePath = path.relative(process.cwd(), absolutePath)
|
||||
// -> /packages/[name]/src
|
||||
const modulePath = path.join(relativePath, '../../dist')
|
||||
|
||||
tsconfig.compilerOptions.paths['@framework'] = [`${provider}`]
|
||||
tsconfig.compilerOptions.paths['@framework/*'] = [`${provider}/*`]
|
||||
console.log('PATH', modulePath)
|
||||
|
||||
tsconfig.compilerOptions.paths['@framework'] = [`${modulePath}`]
|
||||
tsconfig.compilerOptions.paths['@framework/*'] = [`${modulePath}/*`]
|
||||
|
||||
fs.writeFileSync(
|
||||
tsconfigPath,
|
||||
|
@ -23,8 +23,8 @@
|
||||
"@components/*": ["components/*"],
|
||||
"@commerce": ["framework/commerce"],
|
||||
"@commerce/*": ["framework/commerce/*"],
|
||||
"@framework": ["@vercel/commerce-local"],
|
||||
"@framework/*": ["@vercel/commerce-local/*"]
|
||||
"@framework": ["../packages/local/dist"],
|
||||
"@framework/*": ["../packages/local/dist/*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
|
||||
|
Loading…
x
Reference in New Issue
Block a user