Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing moment with time-stamp #70

Closed
wants to merge 1 commit into from

Conversation

fannarsh
Copy link

@fannarsh fannarsh commented Sep 5, 2018

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

There is no need for all the capabilities in moment for one debug log
line. And the bundle size gets a lot smaller.
@gajus
Copy link
Owner

gajus commented Sep 5, 2018

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.

@gajus gajus closed this Sep 5, 2018
@fannarsh
Copy link
Author

fannarsh commented Sep 5, 2018

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 (vercel/next.js#4496), but there is no ETA on that.

Thanks.

@gajus
Copy link
Owner

gajus commented Sep 5, 2018

Just do: npm install & npm run build & rm -fr ./node_modules && npm install --production as part of Dockerfile.

@fannarsh
Copy link
Author

fannarsh commented Sep 5, 2018

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

@fannarsh
Copy link
Author

fannarsh commented Sep 5, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants