UNPKG

react-redux-with-path

Version:

A version of react-redux designed for cases that want to access sub-tree of the state. and take it as state in mapStateToProps and mapDispatchToProps

60 lines (56 loc) 1.33 kB
const webpack = require('webpack'); const path = require('path'); const env = process.env.NODE_ENV const reactExternal = { root: 'React', commonjs2: 'react', commonjs: 'react', amd: 'react' } const reduxExternal = { root: 'Redux', commonjs2: 'redux', commonjs: 'redux', amd: 'redux' } module.exports = { entry: './src/index.js', output: { filename: 'bundle.js', path: path.resolve('./dist'), library: 'ReactReduxWithPath', libraryTarget: 'umd', }, module: { loaders: [ { test: /\.js$/, loader: 'babel', exclude: /node_modules/ }, ], }, plugins: [ { apply: function apply(compiler) { compiler.parser.plugin('expression global', function expressionGlobalPlugin() { this.state.module.addVariable('global', "(function() { return this; }()) || Function('return this')()") return false }) } }, new webpack.optimize.OccurenceOrderPlugin(), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify(env) }), new webpack.optimize.UglifyJsPlugin({ compressor: { pure_getters: true, unsafe: true, unsafe_comps: true, screw_ie8: true, warnings: false } }) ], externals: { 'react': reactExternal, 'redux': reduxExternal, } }