var path = require('path'); var webpack = require('webpack'); var ExtractTextPlugin = require("extract-text-webpack-plugin"); module.exports = { entry: { lesspass: "./src/lesspass" }, output: { path: 'dist', publicPath: '/dist/', filename: '[name].js' }, module: { loaders: [ {test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/}, {test: /\.json$/, loader: 'json-loader'}, {test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader")}, {test: /\.scss$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader!sass-loader")}, { test: /\.(png|jpg|gif|svg|woff2?|eot|ttf)(\?.*)?$/, loader: 'url-loader', query: { limit: 10000, name: '[name].[ext]?[hash]' } } ] }, plugins: [ new ExtractTextPlugin("[name].css") ], devtool: '#eval-source-map' }; if (process.env.NODE_ENV === 'production') { module.exports.devtool = '#source-map'; module.exports.plugins = (module.exports.plugins || []).concat([ new webpack.DefinePlugin({ 'process.env': { NODE_ENV: '"production"' } }), new webpack.optimize.UglifyJsPlugin({ output: {comments: false}, compress: {warnings: false} }), new webpack.optimize.OccurenceOrderPlugin() ]); }