Initial webpack config with JS build support

This commit is contained in:
Jeff Avallone 2016-10-15 12:16:42 -04:00
parent 25473f8b21
commit c55adb13d9
3 changed files with 48 additions and 2 deletions

6
lib/canopy-loader.js Normal file
View File

@ -0,0 +1,6 @@
var canopy = require('canopy');
module.exports = function(source) {
this.cacheable();
return canopy.compile(source);
};

View File

@ -10,8 +10,10 @@
"license": "MIT",
"private": true,
"devDependencies": {
"babel-core": "^6.17.0",
"babel-loader": "^6.2.5",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.3.13",
"babel-preset-es2015": "^6.16.0",
"babel-runtime": "^6.3.19",
"babelify": "^7.1.0",
"browserify": "^13.0.0",
@ -30,6 +32,7 @@
"gulp-sourcemaps": "^1.6.0",
"gulp-uglify": "^1.4.2",
"handlebars-layouts": "^3.1.2",
"imports-loader": "^0.6.5",
"jasmine-core": "^2.4.1",
"karma": "^1.1.2",
"karma-browserify": "^5.0.2",
@ -42,6 +45,7 @@
"through": "^2.3.8",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.7.0"
"watchify": "^3.7.0",
"webpack": "^1.13.2"
}
}

36
webpack.config.js Normal file
View File

@ -0,0 +1,36 @@
var webpack = require('webpack');
module.exports = {
devtool: 'source-map',
entry: {
'js/main.js': './src/js/main.js'
},
output: {
path: __dirname + '/build',
filename: '[name]'
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
],
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel'
},
{
test: require.resolve('snapsvg'),
loader: 'imports-loader?this=>window,fix=>module.exports=0'
},
{
test: /\.peg$/,
loader: __dirname + '/lib/canopy-loader'
}
]
}
};