Update nodemon.json & package.json scripts to use tsconfig-paths
This commit is contained in:
parent
b7f60e1f47
commit
f83cb88bfd
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
"ext": "ts",
|
"ext": "ts",
|
||||||
|
"ignore": ["src/types.ts"],
|
||||||
"exec": "yarn generate:types && ts-node src/server.ts"
|
"exec": "yarn generate:types && ts-node src/server.ts"
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts nodemon",
|
"dev": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts nodemon",
|
||||||
"build:payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build",
|
"build:payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts node -r tsconfig-paths/register node_modules/payload/dist/bin/index.js build",
|
||||||
"build:server": "tsc",
|
"build:server": "tsc",
|
||||||
"build": "yarn build:payload && yarn build:server",
|
"build": "yarn build:payload && yarn build:server",
|
||||||
"serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js node dist/server.js",
|
"serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js node dist/server.js",
|
||||||
"generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:types"
|
"generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts node -r tsconfig-paths/register node_modules/payload/dist/bin/index.js generate:types"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
@ -22,6 +22,7 @@
|
|||||||
"@types/express": "^4.17.9",
|
"@types/express": "^4.17.9",
|
||||||
"nodemon": "^2.0.6",
|
"nodemon": "^2.0.6",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
|
"tsconfig-paths": "^4.2.0",
|
||||||
"typescript": "^5.1.3"
|
"typescript": "^5.1.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,23 @@
|
|||||||
import { buildConfig } from "payload/config";
|
import { buildConfig } from "payload/config";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import Posts from "src/collections/Posts";
|
import Posts from "@/collections/Posts";
|
||||||
import Users from "src/collections/Users";
|
import Users from "@/collections/Users";
|
||||||
import Media from "src/collections/Media";
|
import Media from "@/collections/Media";
|
||||||
|
|
||||||
export default buildConfig({
|
export default buildConfig({
|
||||||
serverURL: process.env.PAYLOAD_URL,
|
serverURL: process.env.PAYLOAD_URL,
|
||||||
admin: {
|
admin: {
|
||||||
user: Users.slug,
|
user: Users.slug,
|
||||||
|
webpack: (config) => ({
|
||||||
|
...config,
|
||||||
|
resolve: {
|
||||||
|
...config.resolve,
|
||||||
|
alias: {
|
||||||
|
...config.resolve.alias,
|
||||||
|
"@": path.resolve(__dirname, "./"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
collections: [Posts, Users, Media],
|
collections: [Posts, Users, Media],
|
||||||
typescript: {
|
typescript: {
|
||||||
|
@ -6,11 +6,13 @@
|
|||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"outDir": "./dist",
|
"outDir": "./dist",
|
||||||
"baseUrl": ".",
|
"paths": {
|
||||||
"rootDir": "./src",
|
"@/*": ["src/*"]
|
||||||
|
},
|
||||||
"jsx": "react"
|
"jsx": "react"
|
||||||
},
|
},
|
||||||
"ts-node": {
|
"ts-node": {
|
||||||
"transpileOnly": true
|
"transpileOnly": true,
|
||||||
|
"require": ["tsconfig-paths/register"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user