webpack-config-demo/webpack.config.js
Primakov Alexandr Alexandrovich cf269ff227 react like bro view
2024-10-17 20:09:08 +03:00

41 lines
833 B
JavaScript

const path = require('node:path');
module.exports = {
mode: 'development',
entry: './src/index.tsx',
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].bundle.js',
publicPath: '/dist/',
assetModuleFilename: 'images/[hash][ext][query]'
},
resolve: {
extensions: ['.tsx', '.ts', '.js', '.jsx'],
},
module: {
rules: [
{
test: /\.(js|jsx|ts|tsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
targets: "defaults",
presets: [
['@babel/preset-env']
]
}
}
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource',
},
{
test: /\.txt$/i,
type: 'asset/source',
}
],
},
};