我在docker-compose中使用create-react-app打字稿。运行docker-compose run --build
时,一切正常,但是如果删除一个文件,则会显示错误:
undefined
TypeScript error in undefined(undefined,undefined):
File '/app/edux-work/src/layouts/Hello.tsx' not found. TS6053
这是dockerfile:
FROM node:10.16-alpine
WORKDIR '/app/edux-work'
COPY ./package.json ./
RUN npm install -g yarn
RUN yarn install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
这是为docker-compose设置的。
work:
build:
dockerfile: Dockerfile.dev
context: ./edux-work
ports:
- 3000:3000
networks:
saigroup:
ipv4_address: 172.22.0.67
volumes:
- /app/edux-work/node_modules
- ./edux-work:/app/edux-work
仅当我在构建docker之前创建删除文件时显示错误。 docker-compose up
时,创建和删除文件不是问题。