Skip to content

Instantly share code, notes, and snippets.

@tedshd
Last active July 1, 2016 04:00
Show Gist options
  • Save tedshd/614ee6f36a6ec6b76ffb088482ef7ba8 to your computer and use it in GitHub Desktop.
Save tedshd/614ee6f36a6ec6b76ffb088482ef7ba8 to your computer and use it in GitHub Desktop.
webpack
require('./const.js');
console.log('this is content');
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
}));
});
});
require('./lib/typeahead.js');
require('./const.js');
console.log('this is header');
{
"name": "",
"version": "",
"devDependencies": {
"jquery": "^1.12.4",
"webpack": "^1.13.1"
}
}
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