Closed fannarsh closed 6 years ago
Thank you for raising the PR.
I do not consider Node.js dependency size (within reason) to be a worthy consideration when deciding which dependencies to use.
Thanks for taking time to look at this.
But I would like to add to my reasoning.
My problem is that moment
as a node.js dependency adds 3.3M to my docker image and that happens when I need to require next.js in my project because it uses write-file-webpack-plugin
as a dependency.
And since write-file-webpack-plugin
is only using moment
for formatting I considered this as a easy fix.
But on the other hand Zeit/Next.js are working on being able to get rid of development dependencies when in production (zeit/next.js#4496), but there is no ETA on that.
Thanks.
Just do: npm install & npm run build & rm -fr ./node_modules && npm install --production
as part of Dockerfile.
The problem is that write-file-webpack-plugin
is a production dependency.
And I'm actually doing
COPY package.json /app/
RUN npm -q install --production --no-optional
RUN rm -rf /app/node_modules/write-file-webpack-plugin \
/app/node_modules/moment
I'm fine with you closing this PR. I just wanted to add a bit more reasoning to the request. I have a work around so I'll live 😄
cheers.
There is no need for all the capabilities in moment for one debug log line. And the bundle size gets a lot smaller.
The current minified size is 339.9 kB with Moment taking up 62.6% of the size. https://bundlephobia.com/result?p=write-file-webpack-plugin@4.4.0
After this change the minified size becomes 111.4 kB