Last active
July 31, 2017 06:13
-
-
Save sureshHARDIYA/8ab25f1899a53c79707f0664ee76ee30 to your computer and use it in GitHub Desktop.
Autoimporting `react` using Webpack’s ProvidePlugin:
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
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