ghondar / crassa Goto Github PK
View Code? Open in Web Editor NEWCreate React App Server Side Application
License: MIT License
Create React App Server Side Application
License: MIT License
Hi, @ghondar
According to npm’s installation rule, it parses the package.json based on the libraries’s declaration order, to construct the node_modules tree. For the libraries that have not been installed in the project, node_modules tree can share them by putting them at the top level of the tree. For the libraries that have been installed, it checks whether their specified version constraints are compatible with the installed ones. If yes, npm ignores them, otherwise, npm will put such duplicated libraries in the subfolders (npm’s sandboxes).
We installed and analyzed the crassa, and found that it is large in size. crassa’s node_modules tree has installed 2218 libraries. 1332 out of 2218 libraries are shared at the top level of the tree, while 886 libraries are the duplicated in the sandboxes. We further checked the duplicated libraries, and listed the them as follows (format: library name, version number, the number of installations on the node_modules tree). For example, “extend-shallow, 2.0.1, 58” denotes that library extend-shallow 2.0.1 has been installed 58 times in this project.
So many duplicated libraries could cause potential problems, such as: slower installs, exploding bundle sizes, and so on.
Based on npm’s installation rules, we comprehensively analyzed the compatibilities of all the transitive dependencies’ version ranges and the topological structure of your node_modules tree. We suggested crassa add the following duplicated libraries with their compatible versions into the package.json file (as shown in the attachment), which help to refactor the project’s node_modules tree. After cleaning the local installation environment and re-installing crassa based on the revised package.json file, we found that the node_modules tree totally installs 1741 libraries, including the 1332 ones at the top level, 409 ones in the sandboxes. As such, the revised package.json file reduces 477 duplicated libraries for crassa. In this manner, reducing 2558 files (from 34530 to 31972) and 678 folders (from 5497 to 4819) in total. Note that, all the added directed dependencies in package.json file are deduced based on the original node_modules tree, which will not miss any required dependencies.
Thank you for your attention.
Best regards.
package.zip
package-lock.zip
the library update, you have to make the change in the proxy
OLD
const proxy = require('http-proxy-middleware')
NEW
const { createProxyMiddleware } = require('http-proxy-middleware')
Example
const { createProxyMiddleware } = require('http-proxy-middleware')
module.exports = function(app) {
const port = process.env.REACT_APP_PORT_SERVER || 5000
app.use(createProxyMiddleware('/api', { target: `http://localhost:${port}/` }))
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.