forked from chad828/dialog-web-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
128 lines (124 loc) · 2.91 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
* Copyright 2018 dialog LLC <[email protected]>
*/
const fs = require('fs');
const path = require('path');
function resolve(...paths) {
return fs.realpathSync(path.join(__dirname, ...paths));
}
const whitelist = [
resolve('src'),
resolve('node_modules/@dlghq/markdown'),
resolve('node_modules/@dlghq/react-l10n'),
resolve('node_modules/@dlghq/dialog-types'),
resolve('node_modules/@dlghq/dialog-utils'),
resolve('node_modules/@dlghq/country-codes')
];
module.exports = {
resolve: {
alias: {
'rsg-components/Wrapper': resolve('src/styleguide/Wrapper.js')
}
},
module: {
rules: [
{
test: /\.js$/,
include: whitelist,
loader: 'babel-loader',
options: {
babelrc: false,
cacheDirectory: true,
presets: [
[
'@dlghq/dialog',
{
modules: false,
runtime: false,
development: true
}
]
]
}
},
{
test: /\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: false,
importLoaders: 1
}
},
{
loader: 'postcss-loader',
options: {
plugins() {
return require('@dlghq/postcss-dialog')({ initial: false });
}
}
}
],
include: [
resolve('src/styles/global.css'),
resolve('src/components/MessageMediaInteractive/example/CodeMirror.css')
]
},
{
test: /\.css$/,
include: whitelist,
exclude: [
resolve('src/styles/global.css'),
resolve('src/components/MessageMediaInteractive/example/CodeMirror.css')
],
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
importLoaders: 1,
localIdentName: '[name]__[local]'
}
},
{
loader: 'postcss-loader',
options: {
plugins() {
return require('@dlghq/postcss-dialog')();
}
}
}
]
},
{
test: /\.json$/,
include: [...whitelist, path.join(__dirname, 'node_modules/entities')],
use: ['json-loader']
},
{
test: /\.yml$/,
include: whitelist,
use: ['yml-loader']
},
{
test: /\.(jpg|png|svg|gif)$/,
include: /./,
exclude: resolve('src/components/Icon/svg'),
use: ['file-loader']
},
{
test: /\.(svg)$/,
include: resolve('src/components/Icon/svg'),
loader: 'svg-sprite-loader'
},
{
test: /\.txt$/,
include: whitelist,
use: ['raw-loader']
}
]
}
};