Skip to content

Commit 9314c44

Browse files
authored
Merge pull request arqex#147 from simeg/dev
Change build configuration
2 parents ce0e0eb + 46d4eee commit 9314c44

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

gulpfile.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
var gulp = require('gulp'),
22
uglify = require('gulp-uglify'),
33
insert = require('gulp-insert'),
4-
webpack = require('gulp-webpack')
4+
webpack = require('gulp-webpack'),
5+
sourcemaps = require('gulp-sourcemaps')
56
;
67

78
var packageName = 'react-datetime';
@@ -34,22 +35,27 @@ var handleError = function( err ){
3435
};
3536

3637
function wp( config, minify ){
37-
var stream = gulp.src('./Datetime.js')
38+
var inputSrc = './Datetime.js';
39+
var destSrc = 'dist/';
40+
41+
var stream = gulp.src( inputSrc )
3842
.pipe( webpack( config ) )
43+
.pipe( sourcemaps.init() )
3944
;
4045

4146
if( minify ){
4247
stream = stream.pipe( uglify() ).on( 'error', handleError );
4348
}
4449

45-
return stream.pipe( insert.prepend( cr ) )
46-
.pipe( gulp.dest('dist/') )
50+
return stream.pipe( sourcemaps.write() )
51+
.pipe( insert.prepend( cr ) )
52+
.pipe( gulp.dest( destSrc ) )
4753
;
4854
}
4955

5056
gulp.task( 'build', function( callback ) {
5157
var config = getWPConfig( 'react-datetime' );
52-
config.devtool = '#eval';
58+
config.devtool = 'cheap-module-source-map';
5359
wp( config );
5460

5561
config = getWPConfig( 'react-datetime.min' );

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"gulp-insert": "^0.4.0",
3838
"gulp-uglify": "^1.2.0",
3939
"gulp-webpack": "^1.5.0",
40+
"gulp-sourcemaps": "^1.6.0",
4041
"jsdom": "^7.0.2",
4142
"mocha": "^2.2.5",
4243
"moment": "2.14.1",

webpack.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ var webpack = require('webpack');
22

33
var plugins = [
44
new webpack.DefinePlugin({
5-
'process.env': { NODE_ENV: '"production"'}
5+
'process.env': {
6+
'NODE_ENV': JSON.stringify('production')
7+
}
68
})
79
];
810

0 commit comments

Comments
 (0)