-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
61 lines (58 loc) · 1.84 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path")
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
module.exports = {
mode: "development",
entry: "./src/main.tsx", // <-- NE
output: {
publicPath: "/",
chunkFilename: "js/[name].[chunkhash].js",
filename: "js/[name].js",
},
module: {
rules: [
{
test: /\.(png|jpg|jpeg|gif)$/i, // Ładuje obrazy
type: 'asset/resource',
generator: {
filename: 'images/[name][ext]', // Katalog dla czcionek
},
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
type: 'asset/resource',
generator: {
filename: 'fonts/[name][ext]', // Katalog dla czcionek
},
},
{
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: ['@svgr/webpack', 'url-loader'],
},
{
test: /\.css$/i,
include: path.resolve(__dirname, 'src'),
use: ['style-loader', { loader: 'css-loader', options: { importLoaders: 1 } }, , 'postcss-loader'],
},
{
test: /\.(js|ts)x?$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
],
},
resolve: {
modules: [__dirname, "src", "node_modules"],
extensions: ["*", ".js", ".jsx", ".tsx", ".ts"],
// @ts-ignore
plugins: [new TsconfigPathsPlugin()]
},
plugins: [new HtmlWebpackPlugin({template:"./src/index.html" })],
devServer: {
historyApiFallback: true,
// static: path.join(__dirname, 'hosting'),
compress: true,
port: 9000
}
};