groupfolders/webpack.prod.config.js
2018-09-03 22:25:45 +02:00

65 lines
1.1 KiB
JavaScript

'use strict';
const path = require("path");
const CleanPlugin = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
devtool: 'source-map',
mode: 'production',
entry: {
app: [
`babel-polyfill`,
`whatwg-fetch`,
'./js/index.tsx'
],
},
output: {
path: path.join(__dirname, "build"),
filename: "bundle.js",
libraryTarget: 'umd',
publicPath: '/'
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
plugins: [
new CleanPlugin(['build']),
new MiniCssExtractPlugin({
filename: 'bundle.css',
allChunks: true
})
],
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'babel-loader',
options: {
babelrc: false,
plugins: ['react-hot-loader/babel'],
},
},
'ts-loader'
]
},
{
test: /.*\.(gif|png|jpe?g|svg|webp)(\?.+)?$/i,
use: [
'url-loader?limit=5000&hash=sha512&digest=hex&name=[hash].[ext]'
]
},
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader'
]
}
]
}
};