node-prune | Remove unnecessary files from node_modules | Runtime Evironment library
kandi X-RAY | node-prune Summary
kandi X-RAY | node-prune Summary
Remove unnecessary files from node_modules (.md, .ts, ...)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of node-prune
node-prune Key Features
node-prune Examples and Code Snippets
Community Discussions
Trending Discussions on node-prune
QUESTION
I am trying to move my tests to my docker image build stage but it seems to ignore my test build at all and just skip it when I build the image.
What can be the problem?
...ANSWER
Answered 2022-Jan-16 at 09:26Docker internally has two different systems to build images. Newer Dockers default to a newer system called BuildKit. One of the major differences is the way the two systems handle multi-stage builds: the older system just runs all of the build stages until the end, but BuildKit figures out that the final stage COPY --from=build
but doesn't use anything from the test
stage, and just skips it.
I wouldn't run these tests in a Dockerfile (since it doesn't produce a runnable artifact) or in Docker at all. I'd probably run them in my host-based development environment, before building a Docker image:
QUESTION
I am trying to access my zeromq run in docker. In my code, I use:
...ANSWER
Answered 2021-Apr-15 at 03:13Try the below
- Check if you have mapped the ports while starting the container
QUESTION
I've used proguard to shrink android app packages before. It removes unused classes and files from app dependencies, even 3rd party ones, resulting in considerably lower package size. Is there an equivalent in node/npm ?
npm prune --production
removes dev dependencies, and node-prune partially removes unused files. But neither completely remove unnecessary code from within a 3rd party package.
ANSWER
Answered 2021-Mar-27 at 16:44You can't remove it completely, node_modules
is needed to run your script.
And you may think there are unused files but they're still needed in some cases.
So let's check it carefully when doing such things. If the total file size is your matter. I recommend to use this tool: https://github.com/tj/node-prune
It gives you some options to control which to remove or not.
QUESTION
This is my first heroku app... and I see that my heroku slug size is 296MB... getting uncomfortably close to the fast 300MB boot time.
This is a puppeteer app with ejs, path, and express installed. I have a bunch of static files but they don't seem to be taking up majority of the space..
I would really appreciate help with this!
Edit: My package.json looks like this now (don't see how I could really trim down my node_modules - in fact, I wanted to add more dependencies as I further develop my app):
...ANSWER
Answered 2020-Nov-15 at 02:01After all the talk in the comments, I realized one thing: you can't delete folders in Heroku dynos! And you probably wouldn't want to anyways... Those folders look important (remember: Heroku dynos are usually mini-linux OSes, so that .apt
folder probably contains some of those mini-linux OS files). And of course, those .apt
and .heroku
folders probably don't add to your slug size. Sorry for that wild goose chase.
So? Let's reduce the sizes of stuff that actually matter.
Number one: reduce yournode_modules
size.
Since your node_modules
folder is the biggest folder that you could control, let's start there. We'll be following this article. I'll be modifying some instructions so that they work with Heroku.
- Reduce the number of dependencies: This may sound like a no-brainer, but it helps a lot. Think about the packages you install. Do you really need them? And if you do, is there a more lightweight package somewhere out there that you could use instead? Example:
A lot of times I see people installing Jest just for simple unit tests (about 460+ dependencies, +/-60MB) when there are smaller libs that will do exactly the same (Mocha – 115 dependencies, 12MB). 2. Remove unnecessary files: Besides the usual installed when you install a package (
.js
files, etc.), there's also a lot of... unneeded junk included (README
s,CHANGELOG
s, source files...). Because you can't remove those files manually (and who wants to), you need to use an automated tool and Heroku build scripts. Here's an example (remove the comments when you put this in yourpackage.json
).
QUESTION
I have a nextjs project that I wish to run using Docker and nginx.
I wish to use nginx that connects to nextjs behind the scenes (only nginx can talk to nextjs, user needs to talk to nginx to talk to nextjs).
Assuming it's standard nextjs project structure and the dockerfile content (provided below), Is there a way to use nginx in docker with nextjs?
I'm aware I can use Docker-compose. But I'd like to keep it under one docker image. Since I plan to push the image to heroku web hosting.
NOTE: I'm using Server Side Rendering
dockerfile
...ANSWER
Answered 2020-Dec-17 at 00:18You can use docker-compose
to run Nginx and your NextJS app in Docker container, then have a bridge network between those containers.
then in nginx conf:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install node-prune
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page