mirror of
https://github.com/vercel/commerce.git
synced 2025-05-19 07:56:59 +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/node": "^15.12.4",
|
||||||
"@types/react": "^17.0.8",
|
"@types/react": "^17.0.8",
|
||||||
"@vercel/fetch": "^6.1.1",
|
"@vercel/fetch": "^6.1.1",
|
||||||
"deepmerge": "*",
|
"deepmerge": "^4.2.2",
|
||||||
"import-cwd": "*",
|
"import-cwd": "^3.0.0",
|
||||||
"js-cookie": "^2.2.1",
|
"js-cookie": "^2.2.1",
|
||||||
"next": "^12.0.3",
|
"next": "^12.0.3",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
".": "./dist/index.js",
|
||||||
"./*": "./dist/*.js",
|
"./*": "./dist/*.js",
|
||||||
"./config": "./dist/config.cjs"
|
"./config": "./dist/config.cjs"
|
||||||
},
|
},
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"pretty": true,
|
"pretty": true,
|
||||||
"jsx": "preserve"
|
"jsx": "react-jsx"
|
||||||
},
|
},
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
".": "./dist/index.js",
|
||||||
"./*": "./dist/*.js",
|
"./*": "./dist/*.js",
|
||||||
"./next.config": "./dist/next.config.cjs"
|
"./next.config": "./dist/next.config.cjs"
|
||||||
},
|
},
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"pretty": true,
|
"pretty": true,
|
||||||
"jsx": "preserve"
|
"jsx": "react-jsx"
|
||||||
},
|
},
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
"exclude": ["node_modules", "dist"]
|
"exclude": ["node_modules", "dist"]
|
||||||
|
@ -42,8 +42,6 @@ function withCommerceConfig(nextConfig = {}) {
|
|||||||
const { commerce } = config
|
const { commerce } = config
|
||||||
const { provider } = commerce
|
const { provider } = commerce
|
||||||
|
|
||||||
console.log('CONFIG', config)
|
|
||||||
|
|
||||||
if (!provider) {
|
if (!provider) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`The commerce provider is missing, please add a valid provider name or its environment variables`
|
`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'
|
commerce.tsconfigPath || 'tsconfig.json'
|
||||||
)
|
)
|
||||||
const tsconfig = require(tsconfigPath)
|
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}`]
|
console.log('PATH', modulePath)
|
||||||
tsconfig.compilerOptions.paths['@framework/*'] = [`${provider}/*`]
|
|
||||||
|
tsconfig.compilerOptions.paths['@framework'] = [`${modulePath}`]
|
||||||
|
tsconfig.compilerOptions.paths['@framework/*'] = [`${modulePath}/*`]
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
tsconfigPath,
|
tsconfigPath,
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
"@components/*": ["components/*"],
|
"@components/*": ["components/*"],
|
||||||
"@commerce": ["framework/commerce"],
|
"@commerce": ["framework/commerce"],
|
||||||
"@commerce/*": ["framework/commerce/*"],
|
"@commerce/*": ["framework/commerce/*"],
|
||||||
"@framework": ["@vercel/commerce-local"],
|
"@framework": ["../packages/local/dist"],
|
||||||
"@framework/*": ["@vercel/commerce-local/*"]
|
"@framework/*": ["../packages/local/dist/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
|
"include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user