Skip to content

Instantly share code, notes, and snippets.

@marcuxyz
Created June 2, 2017 21:54
Show Gist options
  • Save marcuxyz/0bdf36ded42db10e78e011b355060ee4 to your computer and use it in GitHub Desktop.
Save marcuxyz/0bdf36ded42db10e78e011b355060ee4 to your computer and use it in GitHub Desktop.
Webpack para Reactjs
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
module.exports = {
entry: './src/index.jsx',
output: {
path: __dirname + '/public',
filename: './app.js'
},
devServer: {
port: 8080,
contentBase: './public',
},
resolve: {
extensions: ['', '.js', '.jsx'],
alias: {
modules: __dirname + '/node_modules'
}
},
plugins: [
new ExtractTextPlugin('app.css')
],
module: {
loaders: [{
test: /.js[x]?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react'],
plugins: ['transform-object-rest-spread']
}
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader')
}, {
test: /\.woff|.woff2|.ttf|.eot|.svg*.*$/,
loader: 'file'
}]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment