GoogleContainerTools / GoogleContainerTools/skaffold
How to sync node_modules
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
Sometimes I need to link an npm package for developing multiple packages that depend on each other locally. (https://docs.npmjs.com/cli/v6/commands/npm-link)
I can't seem to get file sync to work with node_modules updates from package symlinks. I can confirm that the files in node_modules are updating but they are not being synced. I think it excludes node_modules initially using .dockerignore. If I exclude the scoped packages from the dockerignore (`!node_modules/@scope`) it then struggles to build the image because of a `mkdir -p node_modules/@scope/package` "already exists" error. If I `rm -rf node_modules/@scope` after installing for the image, the node_modules/@scope directory never seems to get built.
I have tried
```
sync:
infer:
- '**/*.ts'
# with this for node_modules/@scope/package/dist/file.js
- '**/*.js'
# or
- 'node_modules/**/*.js'
```
Dockerfile
```
FROM node:14.15.0-alpine as base
WORKDIR /cache
COPY package.json .
COPY yarn.lock .
COPY .npmrc .
RUN yarn
FROM base as build
WORKDIR /app
COPY . ./
COPY --from=base /cache/node_modules /app/node_modules
EXPOSE 3000
CMD ["yarn", "start:dev"]
```
Contributor guide
Assessment
This issue has not been assessed yet.