![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Tool for avoiding the ../../../ relative paths problem, includes browserify-transform to rewrites require() for browser
#requirish
requirish is a tool for avoiding the ../../../ relative paths problem and includes a browserify-transform to rewrites the require() for browser.
You can use it both for your application and also if you are writing a library that could be referenced by others as dependency!
$ npm install --save requirish
In the code, before other require() calls:
require('requirish')._(module);
...
As a browserify-transform:
$ browserify -t requirish app.js > bundle.js
Developing a not trivial Node.js application/library you will face a lot of annoying relative paths in your require() as soon as you start creating a module hierarchy under your ./lib source folder.
Your application, in this example, could have a 'jet.js' module like the following:
$ /Users/bob/my-app/lib/gui/controller/jet.js
and the relative unit-test with the following path:
$ /Users/bob/my-app/test/gui/controller/jet.test.js
Therefore, your 'jet.test.js' unit-test could begin like this:
var jetController = require('../../../lib/gui/controller/jet');
...
In such a case, browserify could resolve this long require() without any problem..
But, how to avoid using the ../../../ relative path to find the 'jet.js' module?
Well, you could write the require('requirish')._(module);
statement - only one time for each module
and before other require() - like the following:
require('requirish')._(module);
var jetController = require('lib/gui/controller/jet');
...
Fine! We will be happy to have now a path-decoupled require() but..
browserify will stop to resolve this new smart version!
And here requirish comes again to the rescue and transforms automagically all the smart require() in the previous ../../../ long version only for the browserify processor!
So, you could run the following browserify command adding the transform:
$ browserify -t requirish test/gui/controller/jet.test.js > test-bundle.js
Now, you will get a bundle that runs on browser without problem! :)
The project is released under the Mit License
FAQs
Tool for avoiding the ../../../ relative paths problem, includes browserify-transform to rewrites require() for browser
We found that requirish demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.