I have the following Dockerfile:
FROM node:12
RUN set -x \
rsyslog \
bash \
curl \
wget \
gettext \
jq
WORKDIR .
COPY package.json .
RUN npm install -g typescript
RUN npm install
COPY . .
RUN npm run build
WORKDIR ./src
RUN tsc --esModuleInterop index.ts
CMD [ "npm", "start" ]
EXPOSE 8080
The include in my tsconfig.json looks as such:
"include": [
"src/controllers/customer/UserAPIController.ts",
"src/controllers/customer/NoticeAPIController.ts",
"src/controllers/merchant/NoticeAPIController.ts",
"src/controllers/customer/MerchantAPIController.ts",
"src/controllers/merchant/MerchantAPIController.ts",
"src/controllers/merchant/UserAPIController.ts",
"src/controllers/customer/SearchAPIController.ts",
"src/controllers/customer/ChatController.ts",
"src/controllers/analytics/AnalyticsAPIController.ts",
"src/controllers/StripeController.ts",
]
All of these files exist in their specified location when I sign into the created docker image.
So what exactly am I doing wrong here?
I am trying to build the index.js and .js files to run the application.
The error was because apparently the TypeScript linter requires a file in the root directory that is TypeScript.
I fixed it by doing the following:
Creating an empty file named "fake.ts"
And adding this to my tsconfig.json:
"include": [
"./fake.ts",
"./src/controllers/customer/UserAPIController.ts",
"./src/controllers/customer/NoticeAPIController.ts",
"./src/controllers/merchant/NoticeAPIController.ts",
"./src/controllers/customer/MerchantAPIController.ts",
"./src/controllers/merchant/MerchantAPIController.ts",
"./src/controllers/merchant/UserAPIController.ts",
"./src/controllers/customer/SearchAPIController.ts",
"./src/controllers/customer/ChatController.ts",
"./src/controllers/analytics/AnalyticsAPIController.ts",
"./src/controllers/StripeController.ts",
],
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.