Files
parcel/webpack.config.ts
2020-08-21 22:53:46 +02:00

47 lines
932 B
TypeScript

import { Configuration } from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import path from 'path';
const __DEV__ = process.env.NODE_ENV !== 'production';
const config: Configuration = {
mode: __DEV__ ? 'development' : 'production',
entry: {
app: [
...(__DEV__ ? ['react-hot-loader/patch'] : []),
path.join(__dirname, 'src', 'index.tsx'),
],
},
output: {
path: path.join(__dirname, 'dist'),
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
alias: {
'react-dom': '@hot-loader/react-dom',
},
},
plugins: [
new HtmlWebpackPlugin({
title: 'Parcel',
minify: true,
}),
],
module: {
rules: [{
test: /\.tsx?$/,
use: ['babel-loader'],
}, {
test: /\.css$/,
use: ['style-loader', 'css-loader'],
}],
},
};
(config as any).devServer = {
hot: true,
contentBase: './dist',
};
export default config;