Created
February 22, 2017 08:01
-
-
Save jakoblind/6986f31fe1e3e0c6e43a4cbea139d673 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 path = require("path"); | |
const webpack = require('webpack'); | |
const fs = require('fs'); | |
module.exports = [{ | |
entry: { | |
app: './frontend/js/app_client.jsx', | |
vendor: "react" | |
}, | |
output: { | |
path: path.join(__dirname, "public"), | |
filename: 'js/[name].[chunkhash].generated.js' | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.jsx?$/, | |
exclude: /node_modules/, | |
use: [{ loader: 'babel-loader' }] | |
}, | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
use: [{ loader: 'babel-loader' }] | |
}, | |
{ | |
test: /\.less$/, | |
use: [ | |
'style-loader', | |
'css-loader', | |
'less-loader' | |
] | |
}, | |
{ | |
test: /\.css$/, | |
use: [ | |
'style-loader', | |
'css-loader' | |
] | |
}, | |
{ | |
test: /\.woff$/, | |
use: ['file-loader'] | |
}, | |
{ | |
test: /\.svg$/, | |
use: ['file-loader'] | |
}, | |
{ | |
test: /\.png$/, | |
use: [{ | |
loader: 'url-loader', | |
options:{ | |
mimetype:'image/png' | |
} | |
}] | |
} | |
] | |
}, | |
externals: { | |
}, | |
resolve: { | |
extensions: ['.js', '.jsx'] | |
}, | |
plugins: [ | |
new webpack.optimize.UglifyJsPlugin({ | |
compress: { | |
warnings: true | |
}, | |
minimize: true, | |
sourceMap: false | |
}), | |
new webpack.DefinePlugin({ | |
'process.env': { | |
'NODE_ENV': '"production"' | |
} | |
}), | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: ['vendor', 'manifest'] | |
}) | |
] | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment