Answer the question
In order to leave comments, you need to log in
How to compile libraries into one file?
Backbone project. I collect all auxiliary libraries in a separate file (assets.js) with the gulp-requirejs plugin.
The problem is connecting the socket.io library. Everything is going fine, but in the browser in the console it gives an error - "Uncaught Error: Mismatched anonymous define () module". The error is 100% due to sockets, because without it it is assembled and works fine.
I bring the section of the gallp config for assembly.
gulp.task("assets_js", ['assets_example_copy'], function() {
rjs({
baseUrl: "www",
mainConfigFile: "config/libConfig.js",
name: "js/assets",
out: "assets.js",
generateSourceMaps: false,
keepAmdefine: true,
preserveLicenseComments: true,
uglify: {
beautify: false,
compress: true
},
mangle: true,
deps: [
'jquery',
'i18n',
'json',
'datepicker',
'iosbugfix',
'fastclick',
'underscore',
'backbone',
'marionette',
'iobind',
'subroute',
'async',
'timezone',
'moment',
'clustering',
'semantic',
'markerwithlabel',
'socket.io'
],
insertRequire: [
'underscore',
'backbone',
'subroute',
'marionette',
'iobind',
'timezone',
'moment',
'socket.io'
]
})
.pipe(gulp.dest("www/js/"));
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question