Created
November 3, 2016 09:06
-
-
Save worst-developer/607bbc8f305aab7924f3cb5a03711ea4 to your computer and use it in GitHub Desktop.
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
const app_root = 'src'; // the app root folder: src, src_users, etc | |
const path = require('path'); | |
const CleanWebpackPlugin = require('clean-webpack-plugin'); | |
const autoprefixer = require('autoprefixer'); | |
const ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
module.exports = { | |
app_root: app_root, | |
entry: [ | |
'webpack-dev-server/client?http://localhost:3005', | |
'webpack/hot/only-dev-server', | |
__dirname + '/' + app_root + '/index.js', | |
], | |
output: { | |
path: __dirname + '/public/js', | |
publicPath: 'js/', | |
filename: 'bundle.js', | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.js$/, | |
loader: 'babel', | |
exclude: /node_modules/, | |
}, | |
{ | |
// https://github.com/jtangelder/sass-loader | |
test: /\.scss$/, | |
loaders: ['style', 'css', 'sass'], | |
}, | |
{ | |
test: /\.css$/, loader: ExtractTextPlugin.extract({ | |
fallbackLoader: "style-loader", | |
loaders: [ | |
'style-loader', | |
'css-loader?importLoaders=1', | |
'postcss-loader' ] | |
}) | |
}, | |
{ | |
test: /\.js$/, | |
loaders: [ "babel-loader", "eslint-loader" ], | |
exclude: /node_modules/, | |
}, | |
{ | |
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/, | |
loader: 'url-loader?limit=8192' | |
} | |
], | |
}, | |
devServer: { | |
contentBase: __dirname + '/public', | |
port: 3005, | |
historyApiFallback: true, | |
devtool: 'source-map', | |
//---------------- here we can declare proxy from backend ----------------- | |
proxy: { | |
// '/': 'http://localhost:8080', | |
} | |
}, | |
plugins: [ | |
new ExtractTextPlugin(__dirname + '/public/css/main.css'), | |
new CleanWebpackPlugin(['css', 'js'], { | |
root: __dirname + '/public', | |
verbose: true, | |
dry: false, | |
}) | |
], | |
postcss: function () { | |
return [autoprefixer({ | |
browsers: ['last 2 versions'] | |
})]; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment