-
Notifications
You must be signed in to change notification settings - Fork 22
/
webpack.config.rules.js
70 lines (70 loc) · 2.06 KB
/
webpack.config.rules.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
module.exports = [
{
test: /\.js$/,
// Exclude node_modules from using babel-loader
// except some that use ES6 modules and need to be transpiled:
// such as swiper http://idangero.us/swiper/get-started/
// and also react-dnd related
exclude: /node_modules\/(?!(dom7|ssr-window)\/).*/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-react"],
},
},
},
{
test: /\.s[ac]ss$/i,
use: ["style-loader", "css-loader", "sass-loader"],
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
// loaders are evaluated from bottom to top (right to left)
// so first transpile via babel, then expose as global
{
test: require.resolve(__dirname + "/static/js/src/public/docs/index.js"),
use: ["expose-loader?exposes=charmhub.docs", "babel-loader"],
},
{
test: require.resolve(__dirname + "/static/js/src/base/base.js"),
use: ["expose-loader?exposes=charmhub.base", "babel-loader"],
},
{
test: require.resolve(
__dirname + "/static/js/src/public/store-details/index.js"
),
use: ["expose-loader?exposes=charmhub.store", "babel-loader"],
},
{
test: require.resolve(__dirname + "/static/js/src/public/topics/index.js"),
use: ["expose-loader?exposes=charmhub.topics", "babel-loader"],
},
{
test: require.resolve(__dirname + "/static/js/src/public/details/index.ts"),
use: ["expose-loader?exposes=charmhub.details", "babel-loader"],
},
{
test: require.resolve(
__dirname + "/static/js/src/public/details/overview/index.js"
),
use: ["expose-loader?exposes=charmhub.details.overview", "babel-loader"],
},
{
test: require.resolve(
__dirname + "/static/js/src/public/details/docs/index.js"
),
use: ["expose-loader?exposes=charmhub.details.docs", "babel-loader"],
},
{
test: require.resolve(
__dirname + "/static/js/src/public/details/resources/index.ts"
),
use: ["expose-loader?exposes=charmhub.resources", "babel-loader"],
},
{
test: /\.tsx?/,
use: ["ts-loader"],
},
];