-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
70 lines (69 loc) · 2.67 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
62
63
64
65
66
67
68
69
70
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
module.exports = [
{
cache: false,
entry: {
MOLEonline_View: './sources/src/View/App.tsx',
MOLEonline_Init: './sources/src/Init/App.tsx',
},
output: {
filename: '[name]-Core.js?version=R1.1.9.1',
path: path.resolve(__dirname, 'dist/'),
},
devtool: 'source-map',
plugins: [
new CopyWebpackPlugin({
patterns: [
{ from: './sources/js/scripts.js', to: 'js/scripts.js' },
{ from: './sources/css/styles.css', to: 'css/styles.css' },
{ from: './sources/css/Init.css', to: 'css/init-styles.css' },
{ from: './sources/images/*', to: () => { return `images/[name][ext]`; } },
{ from: './sources/html/index.html', to: () => { return `index.html`; } },
{ from: './sources/html/*', to: () => { return `html/[name][ext]`; }, globOptions: { ignore: ['**/index.html'] } },
{ from: './sources/config/*', to: () => { return `config/[name][ext]`; } },
{ from: './sources/templates/*', to: () => { return `html/templates/[name][ext]`; } },
{ from: './static/data/*', to: () => { return `static/[name][ext]`; } },
]
}),
],
resolve: {
extensions: ['.tsx', '.ts', '.js', '.scss', '.css', '.json'],
},
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
'@babel/preset-react',
'@babel/preset-typescript'
]
}
},
],
exclude: /node_modules/,
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
sideEffects: true,
},
],
},
},
]