webpack.config.js (801B)
1 const path = require('path'); 2 const webpack = require('webpack'); 3 4 var browserConfig = { 5 target: 'web', 6 entry:{ 7 "youtube-api-v3-search": './src', 8 "youtube-api-v3-search.min": "./src", 9 }, 10 output: { 11 path: path.resolve(__dirname, 'dist'), 12 filename: '[name].js', 13 libraryTarget: 'umd', 14 library:'searchYoutube' 15 }, 16 node: { 17 process: false 18 }, 19 module:{ 20 loaders:[ 21 { 22 test:/\.js$/, 23 exclude:/(node_modules)/, 24 loader:'babel-loader', 25 query:{ 26 presets:['env'] 27 } 28 29 }] 30 }, 31 plugins: [ 32 new webpack.optimize.UglifyJsPlugin({ 33 include: /\.min\.js$/, 34 minimize: true 35 }), 36 new webpack.DefinePlugin({ 37 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) 38 }) 39 ] 40 41 }; 42 43 44 module.exports = [ browserConfig ];