-
Notifications
You must be signed in to change notification settings - Fork 78
/
webpack.tsonly.config.js
113 lines (110 loc) · 2.95 KB
/
webpack.tsonly.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
'use strict';
const _ = require('underscore');
const minimize = process.argv.indexOf('minimize') !== -1;
const webpack = require('webpack');
const path = require('path');
const production = process.env.NODE_ENV === 'production';
const globalizePath = __dirname + '/lib/globalize/globalize.min.js';
let bail;
let plugins = [];
let additionalRules = [];
plugins.push(new webpack.DefinePlugin({
DISABLE_LOGGER: minimize
}))
module.exports = {
entry: {
'CoveoJsSearch.Lazy': ['./src/Lazy.ts'],
'CoveoJsSearch': ['./src/Eager.ts']
},
output: {
path: path.resolve('./bin/js'),
filename: minimize ? '[name].min.js' : '[name].js',
chunkFilename: minimize ? '[name].min.js' : '[name].js',
libraryTarget: 'umd',
// See SwapVar.ts as for why this need to be a temporary variable
library: 'Coveo__temporary',
publicPath: 'js/',
devtoolModuleFilenameTemplate: '[resource-path]'
},
resolve: {
extensions: ['.ts', '.js', '.scss'],
alias: {
'l10n': __dirname + '/lib/l10n/l10n.min.js',
'globalize': globalizePath,
'modal-box': __dirname + '/node_modules/modal-box/bin/ModalBox.min.js',
'magic-box': __dirname + '/node_modules/coveomagicbox/bin/MagicBox.min.js',
'default-language': __dirname + '/src/strings/DefaultLanguage.js',
'jQuery': __dirname + '/test/lib/jquery.js',
'styling': __dirname + '/sass'
},
modules: ['node_modules', path.resolve(__dirname, '/bin/image/css')]
},
devtool: 'source-map',
module: {
rules: [{
test: /underscore-min.js/,
use: [{
loader: 'string-replace-loader',
options: {
search: '//# sourceMappingURL=underscore-min.map',
replace: ''
}
}]
}, {
test: require.resolve(globalizePath),
use: [{
loader: 'expose-loader?Globalize'
}]
}, {
test: /jquery.js/,
use: [{
loader: 'string-replace-loader',
options: {
search: '//@ sourceMappingURL=jquery.min.map',
replace: ''
}
}]
}, {
test: /promise|es6-promise/,
use: [{
loader: 'string-replace-loader',
options: {
search: '//# sourceMappingURL=es6-promise.map',
replace: ''
}
}]
}, {
test: /coveo\.analytics\/dist\/.*\.js/,
use: [{
loader: 'string-replace-loader',
options: {
search: '(?!\n).*\.map',
flags: 'g',
replace: ''
}
}]
}, {
test: /\.(gif|svg|png|jpe?g|ttf|woff2?|eot)$/,
use: [{
loader: 'file-loader',
options: {
name: production ? '../image/[name].[ext]' : 'http://localhost:8080/image/[name].[ext]',
emitFile: false,
publicPath: ' ',
}
}]
}, {
test: /\.ts$/,
use: [{
loader: 'ts-loader'
}]
}, {
test: /\.scss/,
use: [{
loader: 'null-loader'
}]
}]
},
plugins: plugins,
bail: bail
};