我实际上不知道,我应该向您展示哪一部分代码。
我有一个 webApp(reactJs、flux、react-router、nodejs+express 服务器);它工作正常,直到我 uglify main.js 文件。
这里通过后端数据库“搜索”(http://backendless.com/documentation/data/js/data_search_and_query.htm)
var dataQuery = {
condition: conditions,
options: {
pageSize: 18,
relationsDepth: 1
}
}
如果我在 Build 中不使用 gulp uglify,它可以正常工作。如果我确实使用 uglify,我会收到此错误:GET https://api.backendless.com/v1/data/t?pageSize=18&relationsDepth=1 404 (Not Found)
为什么会这样?
完整版本:
GET https://api.backendless.com/v1/data/t?pageSize=18&relationsDepth=1 404 (Not Found)
e._ajax_for_browser.o @ main.js:15
e._ajax_for_browser.a.ignoreCache @ main.js:15
e._ajax_for_browser @ main.js:15
C.find @ main.js:15
r @ main.js:15
(anonymous function) @ main.js:15
r.$Dispatcher_invokeCallback @ main.js:1
r.dispatch @ main.js:1
a.handleViewAction @ main.js:15
o.search @ main.js:12
r.createClass._getInitItems @ main.js:13
r.createClass._getAllEstateItems @ main.js:13
l.addons.update.$merge.searchByParams @ main.js:15
r.createClass.componentDidMount @ main.js:13
o.notifyAll @ main.js:3
m.close @ main.js:9
a.closeAll @ main.js:12
a.perform @ main.js:12
h @ main.js:9
a.perform @ main.js:12
d.batchedUpdates @ main.js:8
o @ main.js:11
$._renderNewRootComponent @ main.js:9
r.measure.i @ main.js:9
$.render @ main.js:9
r.measure.i @ main.js:9
(anonymous function) @ main.js:15
u.createClass.statics.run.L @ main.js:2
(anonymous function) @ main.js:2
(anonymous function) @ main.js:2
(anonymous function) @ main.js:2
r.to @ main.js:2
(anonymous function) @ main.js:2
r.from @ main.js:2
u.createClass.statics.dispatch @ main.js:2
u.createClass.statics.refresh @ main.js:2
u.createClass.statics.run @ main.js:2
r @ main.js:3
250.../jsLibs/1. backendless.min @ main.js:15
a @ main.js:1
e @ main.js:1
(anonymous function) @ main.js:1
UPD#1 Gulpfile.js:
var gulp = require('gulp');
var browserify = require('gulp-browserify');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var uglifycss = require('gulp-uglifycss');
gulp.task('browserify', function() {
gulp.src('src/js/main.js')
.pipe(browserify({transform: 'reactify'}))
.pipe(concat('main.js'))
.pipe(gulp.dest('dist/js'));
});
gulp.task('uglifyjs', function() {
gulp.src('dist/js/main.js')
.pipe(uglify())
.pipe(gulp.dest('dist/js'))
});
gulp.task('copy', function() {
gulp.src('src/index.html')
.pipe(gulp.dest('dist'));
gulp.src('src/assets/**/*.*')
.pipe(gulp.dest('dist/assets'));
});
gulp.task('default',['browserify', 'copy']);
gulp.task('watch', function() {
gulp.watch('src/**/*.*', ['default']);
});
gulp.task('js', function () {
gulp.src('src/jsLibs/*.js')
.pipe(concat('scripts.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/js'))
})
gulp.task('css', function () {
gulp.src('src/css/*.css')
.pipe(concat('styles.css'))
.pipe(uglifycss())
.pipe(gulp.dest('dist/css'))
})