-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathwebpack.config.js
More file actions
65 lines (62 loc) · 2.06 KB
/
webpack.config.js
File metadata and controls
65 lines (62 loc) · 2.06 KB
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
/*
* Copyright 2018 Uncharted Software Inc.
*/
const webpack = require('webpack');
const path = require('path');
const ENTRY = './src/FacetsVisual.ts';
const regex = path.normalize(ENTRY).replace(/\\/g, '\\\\').replace(/\./g, '\\.');
const HANDLEBAR_RUNTIME = 'handlebars/dist/handlebars.runtime.min';
const POWERBI_UTILS = [
'./node_modules/globalize/lib/cultures/globalize.culture.en-US.js',
'./node_modules/powerbi-visuals-utils-typeutils/lib/index.js',
'./node_modules/powerbi-visuals-utils-dataviewutils/lib/index.js',
'./node_modules/powerbi-visuals-utils-formattingutils/lib/index.js'
];
module.exports = {
entry: POWERBI_UTILS.concat(ENTRY),
devtool: 'eval',
resolve: {
extensions: ['.json', '.webpack.js', '.web.js', '.js', '.ts'],
alias: {
handlebars: HANDLEBAR_RUNTIME,
},
},
module: {
rules: [
{
test: new RegExp(regex),
loader: path.join(__dirname, 'bin', 'pbiPluginLoader'),
},
{
test: /\.handlebars$/,
loader: 'handlebars-loader',
query: {
helperDirs: [
path.resolve(__dirname, 'lib/@uncharted/cards/src/handlebarHelper'),
],
runtime: HANDLEBAR_RUNTIME,
},
},
{
test: /\bpowerbi\b.*?\butils\b.*?\bindex\.js\b/,
loader: 'string-replace-loader',
query: {
multiple: [
{ search: 'var powerbi;', replace: 'var powerbi = window.powerbi;' },
{ search: 'var Globalize = Globalize || window["Globalize"];', replace: 'var Globalize = require(\'globalize\');' },
]
}
},
{
test: /\.ts?$/,
loader: 'ts-loader',
},
],
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
}),
],
};