UNPKG

react-kd.ui

Version:
54 lines (49 loc) 1.34 kB
const webpack = require('webpack'); const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin'); const path = require('path'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const minify = process.env.MINIFY ? '.min': ''; const plugins = minify ? [new UglifyJsPlugin({ minimize: true })] : []; // plugins.push(new BundleAnalyzerPlugin()) plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)); const config = { entry: { [`index${minify}.js`]: [`${__dirname}/app/index.js`] }, devtool: 'source-map', output: { path: `${__dirname}/lib`, filename: '[name]', library: 'index', libraryTarget: 'umd', umdNamedDefine: true }, externals: [ 'react', 'react-dom' ], module: { loaders: [ { test: /(\.jsx|\.js)$/, loader: 'babel-loader', exclude: /(node_modules|bower_components)/ }, { test: /\.scss$/, loader: 'style!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss!sass' }, { test: /\.(png|gif)(\?.*)?$/, loader: 'url-loader?mimetype=image/png' }, ] }, resolve: { root: path.resolve('./app'), extensions: ['', '.js'] }, plugins: plugins, postcss: {} }; module.exports = config;