2021-01-07 16:15:34 -08:00
|
|
|
const path = require('path');
|
|
|
|
const HtmlWebPackPlugin = require('html-webpack-plugin');
|
|
|
|
|
2021-08-05 12:07:43 -07:00
|
|
|
const mode = process.env.NODE_ENV === 'production' ? 'production' : 'development';
|
2021-01-07 16:15:34 -08:00
|
|
|
module.exports = {
|
2021-08-05 12:07:43 -07:00
|
|
|
mode,
|
2021-01-07 16:15:34 -08:00
|
|
|
entry: {
|
|
|
|
app: path.join(__dirname, 'index.tsx'),
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.ts', '.js', '.tsx', '.jsx']
|
|
|
|
},
|
2021-08-05 12:07:43 -07:00
|
|
|
devtool: mode === 'production' ? false : 'source-map',
|
2021-01-07 16:15:34 -08:00
|
|
|
output: {
|
|
|
|
globalObject: 'self',
|
|
|
|
filename: '[name].bundle.js',
|
2021-01-28 09:33:20 -08:00
|
|
|
path: path.resolve(__dirname, '../../../lib/web/traceViewer')
|
2021-01-07 16:15:34 -08:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.(j|t)sx?$/,
|
2021-06-23 18:01:48 -07:00
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
presets: [
|
|
|
|
"@babel/preset-typescript",
|
|
|
|
"@babel/preset-react"
|
|
|
|
]
|
|
|
|
},
|
2021-01-07 16:15:34 -08:00
|
|
|
exclude: /node_modules/
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
use: ['style-loader', 'css-loader']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.ttf$/,
|
|
|
|
use: ['file-loader']
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new HtmlWebPackPlugin({
|
|
|
|
title: 'Playwright Trace Viewer',
|
|
|
|
template: path.join(__dirname, 'index.html'),
|
|
|
|
})
|
|
|
|
]
|
|
|
|
};
|