Skip to content

Instantly share code, notes, and snippets.

@worst-developer
Last active November 3, 2016 09:52
Show Gist options
  • Save worst-developer/2a4c515e577772e906ca10f569aef9e6 to your computer and use it in GitHub Desktop.
Save worst-developer/2a4c515e577772e906ca10f569aef9e6 to your computer and use it in GitHub Desktop.
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");
const fontLoader = require('font-awesome-sass-loader');
module.exports = {
app_root: app_root,
entry: [
"font-awesome-sass!./config/font-awesome.config.js",
'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!sass-loader',
'postcss-loader' ]
})
},
{
test: /\.js$/,
loaders: [ "babel-loader", "eslint-loader" ],
exclude: /node_modules/,
},
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff"
},
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file-loader" },
{
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('/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