Last active
July 1, 2016 04:00
-
-
Save tedshd/614ee6f36a6ec6b76ffb088482ef7ba8 to your computer and use it in GitHub Desktop.
webpack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('./const.js'); | |
console.log('this is content'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'), | |
gutil = require("gulp-util"), | |
webpack = require("webpack"), | |
webpackConfig = require("./webpack.config.js"); | |
gulp.task('default', function (cb) { | |
webpack(Object.create(webpackConfig), function(err, stats) { | |
if(err) throw new gutil.PluginError("webpack:build", err); | |
gutil.log("[webpack:build]", stats.toString({ | |
colors: true | |
})); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('./lib/typeahead.js'); | |
require('./const.js'); | |
console.log('this is header'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "", | |
"version": "", | |
"devDependencies": { | |
"jquery": "^1.12.4", | |
"webpack": "^1.13.1" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpack = require('webpack'); | |
const dir = './dev/js/'; | |
module.exports = { | |
entry: { | |
index : [dir + 'header.js'], | |
page : [dir + 'header.js', dir + 'content.js'], | |
list : [dir + 'header.js', dir + 'list.js'], | |
}, | |
output: { | |
filename: '[name].js', | |
path: './bundle/' | |
}, | |
plugins: [ | |
new webpack.ProvidePlugin({ | |
$: "jquery", | |
jQuery: "jquery", | |
"window.jQuery": "jquery" | |
}), | |
new webpack.optimize.UglifyJsPlugin({ | |
compress: { | |
warnings: false, | |
}, | |
output: { | |
comments: false, | |
}, | |
}), | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment