-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
108 lines (106 loc) · 3.5 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
const IgnoreNotFoundExportPlugin = require('ignore-not-found-export-plugin');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
.BundleAnalyzerPlugin;
const packagesPath = [__dirname, '..', '..', 'packages'];
module.exports = {
devtool: 'cheap-module-source-map',
module: {
rules: [
{
test: /\.(t|j)sx?$/,
exclude: /node_modules/,
use: { loader: 'babel-loader' },
},
{
test: /\.html$/,
exclude: /node_modules/,
use: { loader: 'html-loader' },
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html',
}),
new HardSourceWebpackPlugin(),
// required because of https://github.com/babel/babel/issues/7640
new IgnoreNotFoundExportPlugin([
'CallbackSideEffect',
'ChoicesProps',
'InputProps',
'NotificationSideEffect',
'OptionText',
'OptionTextElement',
'RedirectionSideEffect',
'RefreshSideEffect',
'AdminUIProps',
'AdminContextProps',
'AdminRouterProps',
'ReferenceArrayProps',
'ReferenceManyProps',
'LinkToType',
'FormContext',
'UseReferenceProps',
'SortProps',
'PaginationProps',
]),
].concat(
process.env.NODE_ENV === 'development'
? [new BundleAnalyzerPlugin()]
: []
),
resolve:
process.env.USE_ALIAS === 'true'
? {
extensions: ['.ts', '.js', '.tsx', '.json'],
alias: {
'ra-core': path.join(...packagesPath, 'ra-core', 'src'),
'ra-language-french': path.join(
...packagesPath,
'ra-language-french',
'src'
),
'ra-language-english': path.join(
...packagesPath,
'ra-language-english',
'src'
),
'ra-ui-materialui': path.join(
...packagesPath,
'ra-ui-materialui',
'src'
),
'react-admin': path.join(
...packagesPath,
'react-admin',
'src'
),
'ra-data-fakerest': path.join(
...packagesPath,
'ra-data-fakerest',
'src'
),
'ra-i18n-polyglot': path.join(
...packagesPath,
'ra-i18n-polyglot',
'src'
),
'ra-input-rich-text': path.join(
...packagesPath,
'ra-input-rich-text',
'src'
),
},
}
: {},
devServer: {
stats: {
children: false,
chunks: false,
modules: false,
},
},
};