Created
January 11, 2018 12:59
-
-
Save esr360/c431db0d8e84fcbf23edd1830d76333f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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