Good afternoon, help figure out, I can not properly build a project.
I constantly work with NodeJS and here I also had to put angular.
I collect everything through Gulp.
Gulp task:
gulp.task('js', function () { return gulp.src(source()) .pipe(browserify({ insertGlobals: true })) .pipe(concat('bundle.js')) .pipe(uglify()) .pipe(rename({ suffix: '.min' })) .pipe(gulp.dest('./public/build/')); }); Source:
function returnSource(){ var files = [ './public/js/*.js', './public/js/controller/*.js', './public/js/router/*.js', ]; return files; } module.exports.returnSource = returnSource; JS folder structure
JS controller index.js router template view app.js The structure of the app.js file
require('angular'); var app = angular.module('photography', []); Structure of the /controller/index.js file
app.controller("index", function($scope) { $scope.products = [""]; }); Angular installed via npm
I get the output file bundle.min.js
It gives an error when loading the page that Cannot find module (And this is from the require side)
Do not understand why. According to my logic, if I did require ('angular'), then angular.js should be moved from the node_modules folder to the app.js file, and in the end, for some reason, the require functions are also involved.
How to do it right?
