![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.
gulp-resolve-dependencies
Advanced tools
Resolve dependency directives in assets (e.g. "@requires" or "//= require" in JavaScript)
Resolve dependency directives in assets, e.g.
@depend
(Juicer) or//= require
(Sprockets)). Inspired by grunt-concat-in-order. Useful in combination with gulp-concat.
First, install gulp-resolve-dependencies
as a development dependency:
npm install --save-dev gulp-resolve-dependencies
Then, add it to your gulpfile.js
(probably together with gulp-concat):
var resolveDependencies = require('gulp-resolve-dependencies');
var concat = require('gulp-concat');
gulp.task('js', function(){
gulp.src(['app/assets/js/main.js'])
.pipe(resolveDependencies({
pattern: /\* @requires [\s-]*(.*\.js)/g
}))
.on('error', function(err) {
console.log(err.message);
})
.pipe(concat())
.pipe(gulp.dest('dest/assets/js/'));
});
And use the directives in your JS files (dependencies can be nested, they are handled recursively):
/**
* @requires libs/jquery/jquery.js
* @requires ../modules/slideshow/slideshow.js
*/
(function(window, document, $, undefined) {
'use strict';
$(document).on('ready', function() {
$('.slideshow').slideshow();
});
})(window, document, jQuery);
Warning: This might not be very efficient (especially in case of nested dependencies). Some kind of caching mechanism could come in handy.
Circular dependencies are either silently ignored or emit an error. See options.ignoreCircularDependencies
below.
gulp.src
will not necessarily return files in a deterministic way. If this turns out to be an issue, using a plugin like gulp-sort
or gulp-order
right after gulp.src
might be an option for you. Thanks to @fabiospampinato for pointing this out.
Type: RegExp
The matching pattern (defaults to /\* @requires [\s-]*(.*?\.js)/g
).
Type: Function
Resolver for matched paths. Default:
function(match, targetFile) {
return path.join(path.dirname(targetFile.path), match);
}
Parameters:
match
{String} Matched file path (in the example above this would be libs/jquery/jquery.js
and ../modules/slideshow/slideshow.js
, respectively)targetFile
{Vinyl file object} Currently parsed file (where the matches were found)The path
package is available in this context.
Returning a falsy value will ignore the resolved path:
function(match, targetFile) {
// Ignore `/lib.js`
if (match.match(/\/lib\.js$/)) {
return null;
}
return path.join(path.dirname(targetFile.path), match);
}
Type: Boolean
Whether to log the resolved dependencies (defaults to false
).
Type: Boolean
Whether to just continue instead of emitting an error if circular dependencies are detected (defaults to false
).
Type: Array
Only dependencies matching this array of absolute paths will be included (defaults to []
).
Type: Array
Dependencies matching this array of absolute paths will be excluded (defaults to []
).
FAQs
Resolve dependency directives in assets (e.g. "@requires" or "//= require" in JavaScript)
The npm package gulp-resolve-dependencies receives a total of 76 weekly downloads. As such, gulp-resolve-dependencies popularity was classified as not popular.
We found that gulp-resolve-dependencies 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.