Created
July 21, 2017 17:41
-
-
Save ppeeou/3479755efdac7e74acb462d40df1ba39 to your computer and use it in GitHub Desktop.
webpack react
This file contains hidden or 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
| /* webpack js */ | |
| var webpack = require('webpack'); | |
| module.exports = { | |
| entry: './src/index.js', | |
| output: { | |
| path: __dirname + '/public/', | |
| filename: 'bundle.js' | |
| }, | |
| devServer: { | |
| hot: true, | |
| inline: true, | |
| host: '0.0.0.0', | |
| port: 8080, | |
| contentBase: __dirname + '/public/' | |
| }, | |
| module: { | |
| loaders: [ | |
| { | |
| test: /\.js$/, | |
| loaders: ['react-hot-loader', 'babel-loader?' + JSON.stringify( | |
| { | |
| cacheDirectory: true, | |
| presets: ['es2015', 'react'] | |
| })], | |
| exclude: /node_modules/ | |
| } | |
| ] | |
| }, | |
| plugins: [ | |
| new webpack.HotModuleReplacementPlugin() | |
| ] | |
| } | |
| /* package.json */ | |
| { | |
| "name": "webpack-react", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1", | |
| "dev" :"webpack-dev-server" | |
| }, | |
| "author": "", | |
| "license": "ISC", | |
| "dependencies": { | |
| "react": "^15.6.1", | |
| "react-dom": "^15.6.1" | |
| }, | |
| "devDependencies": { | |
| "babel-core": "^6.25.0", | |
| "babel-loader": "^7.1.1", | |
| "babel-preset-es2015": "^6.24.1", | |
| "babel-preset-react": "^6.24.1", | |
| "react-hot-loader": "^1.3.1", | |
| "webpack": "^3.3.0", | |
| "webpack-dev-server": "^2.5.1" | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment