Skip to content

Commit

Permalink
upgrade(dependencies): Webpack 2 (#23)
Browse files Browse the repository at this point in the history
* upgrade(dependencies): Webpack 2

Move sourcemap to plugin

* Add webpack-stream
  • Loading branch information
Andrew Throener authored and Daniel Brain committed Mar 15, 2017
1 parent 8f9901b commit 64d4273
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
25 changes: 16 additions & 9 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
var gulp = require('gulp');
var eslint = require('gulp-eslint');
var webpack = require('webpack');
var gulpWebpack = require('gulp-webpack');
var gulpWebpack = require('webpack-stream');
var Server = require('karma').Server;
var argv = require('yargs').argv;
var UglifyJSPlugin = require('uglifyjs-webpack-plugin');

gulp.task('test', ['lint', 'karma']);
gulp.task('build', ['lint', 'karma', 'webpack', 'webpack-min']);
Expand All @@ -13,12 +14,12 @@ var FILE_NAME = 'post-robot';
var MODULE_NAME = 'postRobot';

var WEBPACK_CONFIG = {
devtool: 'source-map',
// devtool: 'source-map',
module: {
loaders: [
rules: [
{
test: /\.js$/,
loader: 'babel',
loader: 'babel-loader',
query: {
presets: ['es2015'],
plugins: [
Expand All @@ -33,7 +34,7 @@ var WEBPACK_CONFIG = {
]
},
resolve: {
modulesDirectories: [
modules: [
'node_modules',
'src',
'client'
Expand All @@ -48,6 +49,9 @@ var WEBPACK_CONFIG = {
plugins: [
new webpack.DefinePlugin({
__TEST__: false
}),
new webpack.SourceMapDevToolPlugin({
filename: '[file].map'
})
],
bail: true
Expand All @@ -64,23 +68,26 @@ var WEBPACK_CONFIG_MIN = Object.assign({}, WEBPACK_CONFIG, {
new webpack.DefinePlugin({
__TEST__: false
}),
new webpack.optimize.UglifyJsPlugin({
new webpack.SourceMapDevToolPlugin({
filename: '[file].map'
}),
new UglifyJSPlugin({
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
minimize: true
sourceMap: true
})
]
});

gulp.task('webpack', ['lint'], function() {
return gulp.src('src/index.js')
.pipe(gulpWebpack(WEBPACK_CONFIG))
.pipe(gulpWebpack(WEBPACK_CONFIG, webpack))
.pipe(gulp.dest('dist'));
});

gulp.task('webpack-min', ['lint'], function() {
return gulp.src('src/index.js')
.pipe(gulpWebpack(WEBPACK_CONFIG_MIN))
.pipe(gulpWebpack(WEBPACK_CONFIG_MIN, webpack))
.pipe(gulp.dest('dist'));
});

Expand Down
11 changes: 4 additions & 7 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,18 @@ module.exports = function(config) {
devtool: 'inline-source-map',

resolve: {
root: [
__dirname
],

modulesDirectories: [
modules: [
__dirname,
'node_modules'
]
},

module: {
loaders: [
rules: [
{
test: /\.js$/,
exclude: /(dist)/,
loader: 'babel',
loader: 'babel-loader',
query: {
presets: ['es2015'],
plugins: [
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"gulp": "^3.9.1",
"gulp-eslint": "^2.0.0",
"gulp-karma": "0.0.5",
"gulp-webpack": "^1.5.0",
"istanbul-instrumenter-loader": "^0.2.0",
"karma": "^0.13.22",
"karma-chrome-launcher": "^1.0.1",
Expand All @@ -54,13 +53,15 @@
"karma-sinon-chai": "^1.2.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.26",
"karma-webpack": "^1.7.0",
"karma-webpack": "^2.0.3",
"lolex": "^1.5.0",
"mocha": "^2.4.5",
"phantomjs-prebuilt": "^2.1.7",
"sinon": "^1.17.4",
"sinon-chai": "^2.8.0",
"webpack": "^1.13.0",
"uglifyjs-webpack-plugin": "^0.3.0",
"webpack": "^2.2.1",
"webpack-stream": "^3.2.0",
"yargs": "^4.7.1"
},
"dependencies": {
Expand Down

0 comments on commit 64d4273

Please # to comment.