webpack-config-demo/webpack.config.js

41 lines
833 B
JavaScript
Raw Permalink Normal View History

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