-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
85 lines (84 loc) · 1.65 KB
/
webpack.config.ts
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import path from 'path';
const r = require.resolve;
export default function(ec_path) {
return {
devtool: 'eval-source-maps',
entry: {
'bundle.js': [
// Relative path from the dist dir not the root
path.resolve(__dirname, '../admin-panel/index.tsx'),
...ec_path,
],
},
output: {
filename: '[name]',
path: path.resolve(__dirname, '../public-admin'),
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: path.resolve(__dirname, 'node_modules'),
use: {
loader: r('babel-loader'),
options: {
presets: [
r('@babel/preset-env'),
r('@babel/preset-react'),
],
plugins: [r('@babel/plugin-transform-react-jsx')],
},
},
},
{
test: /\.s?css$/,
use: [r('style-loader'), r('css-loader'), r('sass-loader')],
},
{
test: /\.svg$/,
use: [
{
loader: r('babel-loader'),
options: {
presets: [
r('@babel/preset-env'),
r('@babel/preset-react'),
],
plugins: [
r('@babel/plugin-transform-react-jsx'),
],
},
},
{
loader: r('react-svg-loader'),
options: {
jsx: true,
},
},
],
},
{
test: /\.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: r('file-loader'),
options: {
name: '[name].[ext]',
outputPath: 'fonts/',
},
},
],
},
{
test: /\.tsx?$/,
use: r('ts-loader'),
exclude: /node_modules/,
},
],
},
resolve: {
extensions: ['.js', '.jsx', '.scss', '.svg', '.ts', '.tsx'],
},
mode: 'development',
};
}