diff --git a/client/gulpfile.js b/client/gulpfile.js index c7139b52cbfa..06eebf5605a2 100644 --- a/client/gulpfile.js +++ b/client/gulpfile.js @@ -44,16 +44,20 @@ var dev_mode = function(){ return process.env.NODE_ENV != "production"; }; +var source_maps = function(){ + return dev_mode() || process.env.GXY_BUILD_SOURCEMAPS !== undefined; +}; + gulp.task('scripts', function() { return gulp.src(paths.scripts) .pipe(plumber()) .pipe(cached('scripts')) - .pipe(gulpif(dev_mode, sourcemaps.init())) + .pipe(gulpif(source_maps, sourcemaps.init())) .pipe(babel({ plugins: ['transform-es2015-modules-amd'] })) .pipe(gulpif(dev_mode, beautify(), uglify())) - .pipe(gulpif(dev_mode, sourcemaps.write('../maps/'))) + .pipe(gulpif(source_maps, sourcemaps.write('../maps/'))) .pipe(gulp.dest('../static/scripts/')); }); diff --git a/client/package.json b/client/package.json index 1650010fdcd4..4a8e3216c07c 100644 --- a/client/package.json +++ b/client/package.json @@ -32,14 +32,17 @@ "watch": "gulp stage-libs && concurrently \"yarn run webpack-watch\" \"yarn run gulp watch\" \"yarn run style-watch\"", "build": "NODE_ENV=development gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack\" \"yarn run gulp clean && yarn run gulp\"", "build-production": "NODE_ENV=production gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack-production\" \"yarn run gulp clean && yarn run gulp-production\"", + "build-production-maps": "NODE_ENV=production gulp stage-libs && concurrently \"yarn run style\" \"yarn run webpack-production-maps\" \"yarn run gulp clean && yarn run gulp-production-maps\"", "webpack": "webpack -d", "webpack-watch": "webpack -d --watch", "webpack-production": "webpack -p", + "webpack-production-maps": "GXY_BUILD_SOURCEMAPS=1 webpack -p", "style": "grunt style", "style-watch": "grunt watch-style", "test": "karma start --verbose --single-run --no-auto-watch karma.config.js", "gulp": "gulp", "gulp-production": "NODE_ENV=production gulp", + "gulp-production-maps": "GXY_BUILD_SOURCEMAPS=1 NODE_ENV=production gulp", "build-toolshed": "grunt --app=toolshed", "jshint": "jshint --exclude='galaxy/scripts/libs/**' galaxy/scripts/**/*.js", "build-charts": "webpack -p --config ../config/plugins/visualizations/charts/webpack.config.js", diff --git a/client/webpack.config.js b/client/webpack.config.js index dfdb350dac2f..6e77cb7386bd 100644 --- a/client/webpack.config.js +++ b/client/webpack.config.js @@ -37,7 +37,7 @@ var commonLibs = [ "onload" ]; -module.exports = { +let buildconfig = { entry: { libs: commonLibs, login: "./galaxy/scripts/apps/login.js", @@ -118,3 +118,9 @@ module.exports = { // new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }) ] }; + +if (process.env.GXY_BUILD_SOURCEMAPS){ + buildconfig.devtool = 'source-map'; +} + +module.exports = buildconfig;