This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
64 lines (63 loc) · 2.06 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
const URLImportPlugin = require("webpack-external-import/webpack");
const path = require('path');
module.exports = {
mode: 'production',
devtool: 'source-map',
entry: {
[require('./cumulocity.json').contextPath]: './dist/bundle-src/custom-widget.js'
},
resolve: {
alias: {
"~styles": path.resolve(__dirname, 'styles')
}
},
module: {
rules: [
{
test: /\.js$/,
use: ["source-map-loader"],
enforce: "pre"
},{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},{
test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/i,
loader: 'url-loader',
options: {
limit: 8192,
publicPath: `/apps/${require('./cumulocity').contextPath}/`
},
}
]
},
optimization: {
runtimeChunk: {
name: "webpackRuntime"
}
},
plugins: [
new URLImportPlugin ({
manifestName: require('./cumulocity').contextPath,
fileName: "importManifest.js",
basePath: '',
publicPath: `/apps/${require('./cumulocity').contextPath}/`,
useExternals: {
"@angular/animations": "AngularAnimations",
"@angular/common": "AngularCommon",
"@angular/common/http": "AngularCommonHttp",
"@angular/core": "AngularCore",
"@angular/forms": "AngularForms",
"@angular/http": "AngularHttp",
"@angular/platform-browser": "AngularPlatformBrowser",
"@angular/platform-browser/animations": "AngularPlatformBrowserAnimations",
"@angular/router": "AngularRouter",
"@c8y/client": "C8yClient",
"@c8y/ngx-components": "C8yNgxComponents"
},
})
],
output: {
filename: '[contenthash].js',
path: path.resolve(__dirname, 'dist/widget')
},
};