Last active
August 4, 2018 20:24
-
-
Save trooperandz/cdf57598e12b87eeb260e6bcc28becc0 to your computer and use it in GitHub Desktop.
Basic webpack config file for React app from scratch blog post
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
const path = require('path'); | |
const webpack = require('webpack'); | |
const BrowserSyncPlugin = require('browser-sync-webpack-plugin'); | |
module.exports = { | |
entry: './src/index.js', | |
mode: 'development', | |
module: { | |
rules: [ | |
{ | |
test: /\.(js|jsx)$/, | |
exclude: /(node_modules|bower_components)/, | |
loader: 'babel-loader', | |
options: { presets: ['env'] }, | |
}, | |
], | |
}, | |
resolve: { extensions: ['*', '.js', '.jsx'] }, | |
output: { | |
path: path.resolve(__dirname, 'dist/'), | |
publicPath: '/dist/', | |
filename: 'bundle.js', | |
}, | |
devServer: { | |
contentBase: path.join(__dirname, 'public/'), | |
port: 3000, | |
publicPath: 'http://localhost:3000/dist/', | |
hotOnly: true, | |
}, | |
plugins: [ | |
new webpack.HotModuleReplacementPlugin(), | |
new BrowserSyncPlugin({ | |
host: 'localhost', | |
port: 8080, | |
proxy: 'http://localhost:3000/', | |
}), | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment