Skip to content

Instantly share code, notes, and snippets.

@esr360
Created January 11, 2018 12:59
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 esr360/c431db0d8e84fcbf23edd1830d76333f to your computer and use it in GitHub Desktop.
Save esr360/c431db0d8e84fcbf23edd1830d76333f to your computer and use it in GitHub Desktop.
import path from 'path';
import webpack from 'webpack';
export default function(env) {
const target = env.target || 'node';
const entry = (target === 'node') ? {'synergy': './src/index.js'} : {
'synergy.web': './src/js/synergy.js',
'synergy.web.min': './src/js/synergy.js',
};
return {
entry,
output: {
path: path.resolve(__dirname, 'dist/'),
filename: '[name].js',
publicPath: '/',
libraryTarget: (target === 'node') ? 'commonjs2' : 'var'
},
target,
plugins: [
new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true
})
],
node: { Buffer: (target === 'web') ? false : true },
module: {
loaders: [{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loaders: ['babel-loader'],
}]
},
stats: { colors: true },
devtool: false
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment