47 lines
No EOL
1,021 B
TypeScript
47 lines
No EOL
1,021 B
TypeScript
import webpack from 'webpack';
|
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
import path from 'path';
|
|
|
|
const config: webpack.Configuration = {
|
|
entry: './src/index.tsx',
|
|
mode: 'production',
|
|
output: {
|
|
path: path.resolve(__dirname, './build'),
|
|
filename: 'index.js',
|
|
},
|
|
target: 'web',
|
|
resolve: {
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.(ts|tsx)$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
'loader': 'babel-loader',
|
|
options: {
|
|
presets: [
|
|
'@babel/typescript',
|
|
'@babel/preset-react',
|
|
['@babel/preset-env', {
|
|
targets: 'defaults'
|
|
}]
|
|
]
|
|
}
|
|
},
|
|
},
|
|
{
|
|
test: /\.css$/i,
|
|
use: ['style-loader', 'css-loader'],
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
template: path.join(__dirname, 'public', 'index.html')
|
|
})
|
|
]
|
|
};
|
|
|
|
export default config; |