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",
|
||||
"ignore": ["src/types.ts"],
|
||||
"exec": "yarn generate:types && ts-node src/server.ts"
|
||||
}
|
||||
|
@ -6,11 +6,11 @@
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"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": "yarn build:payload && yarn build:server",
|
||||
"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": {
|
||||
"cross-env": "^7.0.3",
|
||||
@ -22,6 +22,7 @@
|
||||
"@types/express": "^4.17.9",
|
||||
"nodemon": "^2.0.6",
|
||||
"ts-node": "^10.9.1",
|
||||
"tsconfig-paths": "^4.2.0",
|
||||
"typescript": "^5.1.3"
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,23 @@
|
||||
import { buildConfig } from "payload/config";
|
||||
import path from "path";
|
||||
import Posts from "src/collections/Posts";
|
||||
import Users from "src/collections/Users";
|
||||
import Media from "src/collections/Media";
|
||||
import Posts from "@/collections/Posts";
|
||||
import Users from "@/collections/Users";
|
||||
import Media from "@/collections/Media";
|
||||
|
||||
export default buildConfig({
|
||||
serverURL: process.env.PAYLOAD_URL,
|
||||
admin: {
|
||||
user: Users.slug,
|
||||
webpack: (config) => ({
|
||||
...config,
|
||||
resolve: {
|
||||
...config.resolve,
|
||||
alias: {
|
||||
...config.resolve.alias,
|
||||
"@": path.resolve(__dirname, "./"),
|
||||
},
|
||||
},
|
||||
}),
|
||||
},
|
||||
collections: [Posts, Users, Media],
|
||||
typescript: {
|
||||
|
@ -6,11 +6,13 @@
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"outDir": "./dist",
|
||||
"baseUrl": ".",
|
||||
"rootDir": "./src",
|
||||
"paths": {
|
||||
"@/*": ["src/*"]
|
||||
},
|
||||
"jsx": "react"
|
||||
},
|
||||
"ts-node": {
|
||||
"transpileOnly": true
|
||||
"transpileOnly": true,
|
||||
"require": ["tsconfig-paths/register"]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user