![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-require-angular
Advanced tools
require() AngularJS modules/dependencies without having to type require()
npm install gulp-require-angular --save-dev
A gulp plugin which scans your AngularJS project source files and generates a single js file full of require()
statements which can be then used as an entry file for Browserify or Webpack. Only AngularJS modules which appear in the dependency tree of your mainModule
are require()
'd. Supports modules installed with bower too.
So that the majority of your code base will be automatically require()
'd in the correct order while still enabling you use require()
where you want.
See demos for working examples. Also here's a fork of angular-seed with gulp-require-angular and browserify
Write your app using standard AngularJS syntax. e.g.
app.js
angular.module('myApp', ['moduleA']);
moduleA/moduleA.js
angular.module('moduleA', []);
moduleA/moduleA.ctrl.js
angular.module('moduleA').controller('abc',function ($scope) {
});
Use the plugin as part of your gulp task
var gulp = require('gulp');
var requireAngular = require('gulp-require-angular');
gulp.task('requireAngular', function () {
gulp.src(['src/**/*.js'])
.pipe(requireAngular('myApp'))
.pipe(gulp.dest('src/'))
});
The above will generate a file named (by default) gulp-require-angular.generated.js
which will contain:
require('./app.js');
require('./moduleA/moduleA.js');
require('./moduleA/moduleA.ctrl.js');
You then use gulp-require-angular.generated.js
as the entry file for Browserify or Webpack. The benefit of this is that all your Angular is automatically required, while you can still use require()
inside your controllers / services / directives to pull in non angular modules / templates / css depending on your Browserify transforms / Webpack loaders.
e.g. you might have a charting directive that uses an existing a non angular charting library. One of the cleanest ways to pull in that external library dependency is to require()
it:
var nonAngularPieChart = require('./nonAngularPieChart');
angular.module('pieChart', []).directive('pieChart', function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var options = scope.$eval(attrs.chartOptions);
nonAngularPieChart(element, options);
}
};
});
The plugin will only find modules if angular.module
is used. If you alias the variable angular
or have modules in minifed code, e.g. a.module
, it will not be found. You must use unminified versions of third party modules like ui-router, ngResource etc in your project src.
requireAngular('mainModule', options);
mainModule is the name of the module entry point used to calculate the module dependency tree. This is your top level module, and is going to be the same module name found in ng-app
.
Object with the following default properties
{
filename: 'gulp-require-angular.generated.js',
rebase: './',
base: '',
errorOnMissingModules: false,
bower: false,
mainBowerFiles: {}
}
The name of the generated .js file.
The base path to apply to all require statements.
The directory to place the generated file. By default it is the base path of everything in gulp.src
When a module appears in the dependency tree, but cannot be found in a file, emit an error or not.
To look for bower installed packages or not. If true
, bower.json
must be present. Will only look for bower packages which are installed, i.e. listed as dependencies in bower.json
.
Options object to pass through to bower-main-files
FAQs
require() AngularJS modules/dependencies without having to type require()
The npm package gulp-require-angular receives a total of 0 weekly downloads. As such, gulp-require-angular popularity was classified as not popular.
We found that gulp-require-angular 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.