Answer the question
In order to leave comments, you need to log in
JS: How to convert existing project dynamic loading system to requireJS?
There is a system of asynchronous loading of modules.
But there is a desire to collect the project and / or individual modules into a common file with the necessary dependencies using gulp.
The loading structure looks like this:
How can this be done with requirejs or something like that?
Earlier I asked a similar question, but I did not receive an answer to it: What is better to use to load modules - if you need to build the project later?
Attempts to solve this issue:
I tried to start writing in *.boot.js files :
define( 'requirejsTest',
[ 'requirejsTest' ] /* Необходимо загрузить файл requirejsTest*/,
function( requirejs ) { debugger; }
);
require( [ 'requirejsTest' ],
function( requirejs )
{
debugger;
} );
Answer the question
In order to leave comments, you need to log in
Named modules began to work strangely from some point. I suspect they were broken and not fixed. I understand you need something like this:
define(function(require, exports, module) { // первый аргумент должен быть именно require, остальные можно опустить
var a = require('a'),
b = require('b');
//Return the module value
return function () {};
}
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question