-
Notifications
You must be signed in to change notification settings - Fork 35
/
webpack.config.js
86 lines (84 loc) · 2.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
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: [path.join(__dirname, 'index')],
devtool: 'inline-source-map', //just do inline source maps instead of the default
output: {
path: path.join(process.cwd(), 'dist'),
filename: 'app.bundle.js',
},
resolve: {
modules: [
__dirname,
path.join(__dirname, 'client'),
path.join(__dirname, 'node_modules/superdesk-core'),
path.join(__dirname, 'node_modules/superdesk-core/scripts'),
path.join(__dirname, 'node_modules/superdesk-core/styles/sass'),
'node_modules'
],
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
alias: {
images: path.resolve(__dirname, 'node_modules/superdesk-core/images'),
}
},
module: {
rules: [
{
test: /\.(ts|tsx)?$/,
exclude: /node_modules\/(?!(superdesk-core)\/).*/,
loader: 'ts-loader',
options: {
transpileOnly: true
}
},
{
test: /\.(js|jsx)?$/,
exclude: /node_modules\/(?!(superdesk-core)\/).*/,
loader: 'ts-loader',
options: {
transpileOnly: true
}
},
{
test: /\.html$/,
loader: 'html-loader'
},
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.scss$/,
use: [
'style-loader',
'css-loader',
'sass-loader'
]
},
{
test: /\.json$/,
use: ['json-loader']
},
{
test: /\.(png|gif|jpeg|jpg|woff|woff2|eot|ttf|svg)(\?.*$|$)/,
loader: 'file-loader'
}
],
},
externals: {
cheerio: 'window',
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true
},
// Define mock gettext ('required when running unit_tests for planning)
plugins: [
new webpack.DefinePlugin({
gettext: 'function gettext(msg) { return msg; }',
__SUPERDESK_CONFIG__: JSON.stringify({}),
}),
],
};