Skip to content

Instantly share code, notes, and snippets.

@sureshHARDIYA
Last active July 31, 2017 06:13
Show Gist options
  • Save sureshHARDIYA/8ab25f1899a53c79707f0664ee76ee30 to your computer and use it in GitHub Desktop.
Save sureshHARDIYA/8ab25f1899a53c79707f0664ee76ee30 to your computer and use it in GitHub Desktop.
Autoimporting `react` using Webpack’s ProvidePlugin:
var path = require('path');
var webpack = require('webpack');
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./src/index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/'
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.ProvidePlugin({
'React': 'react'
})
],
module: {
loaders: [{
test: /\.js$/,
loaders: ['react-hot', 'babel'],
include: path.join(__dirname, 'src')
}]
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment