Skip to content

Instantly share code, notes, and snippets.

@pavtaras
Last active October 30, 2016 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavtaras/e3362705f267b865151c2bc226a5e635 to your computer and use it in GitHub Desktop.
Save pavtaras/e3362705f267b865151c2bc226a5e635 to your computer and use it in GitHub Desktop.
var path = require('path'),
webpack = require('webpack'),
ExtractTextPlugin = require("extract-text-webpack-plugin"),
ngAnnotatePlugin = require('ng-annotate-webpack-plugin');;
var isDevMode = process.env.NODE_ENV === 'development';
var exportObj = {
context: path.join(__dirname, 'frontend'),
entry: {
app: './js/app.js'
},
output: {
publicPath: '/frontend/',
path: path.join(__dirname, 'public', 'frontend'),
filename: './js/[name].js',
},
module: {
loaders: [
{test: /\.jade$/, loader: 'jade'},
{test: /\.less$/, loader: 'style!css!less'},
{test: /\.styl$/, loader: ExtractTextPlugin.extract('style', 'css!stylus?resolve url')},
{test: /\.(png|jpg|svg|ttf|eot|woff|woff2)$/, loader: 'file?name=styles/[name].[ext]'},
]
},
plugins: [
new ExtractTextPlugin('styles/[name].css', {allChunks: true, disable: isDevMode})
],
devtool: isDevMode ? 'eval' : 'source-map',
watch: false,
devServer: {
host: 'localhost',
port: 3333,
contentBase: path.join(__dirname, 'public')
}
};
if(!isDevMode){
exportObj.plugins.push(new ngAnnotatePlugin());
exportObj.plugins.push(new webpack.optimize.UglifyJsPlugin({compressor: {warnings: false} }));
}
module.exports = exportObj;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment