-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
88 lines (82 loc) · 2.31 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
87
88
const {
resolve,
join
} = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webcomponentsjs = './node_modules/@webcomponents/webcomponentsjs';
const ANGULAR_DIST = './packages/ae-img/dist';
const VANILLA_DIST = './packages/vwc-img/dist';
const VUE_DIST = './packages/vwcw-img/dist';
const STENCIL_DIST = './packages/stencil-img/www';
const POLYMER_DIST = './packages/lit-img/dist';
const SVELTE_DIST = './packages/svelte-img/public';
const elements = [{
from: resolve(`${ANGULAR_DIST}/*.{js,map}`),
to: join(resolve('docs'), 'elements'),
flatten: true
},
{
from: resolve(`${VANILLA_DIST}/*.{js,map}`),
to: join(resolve('docs'), 'elements'),
flatten: true
},
{
from: resolve(`${VUE_DIST}/vwcw-img.min.js`),
to: join(resolve('docs'), 'elements'),
flatten: true
},
{
from: resolve(`${STENCIL_DIST}/build`),
to: join(resolve('docs'), 'elements/stencil')
},
{
from: resolve(`${POLYMER_DIST}/lit-img.js`),
to: join(resolve('docs'), 'elements'),
flatten: true
}, {
from: resolve(`${SVELTE_DIST}/svelte-img.js`),
to: join(resolve('docs'), 'elements'),
flatten: true
}
];
const polyfills = [{
from: resolve(`${webcomponentsjs}/webcomponents-*.{js,map}`),
to: join(resolve('docs'), 'vendor'),
flatten: true
},
{
from: resolve(`${webcomponentsjs}/bundles/*.{js,map}`),
to: join(resolve('docs'), 'vendor', 'bundles'),
flatten: true
},
{
from: resolve(`${webcomponentsjs}/custom-elements-es5-adapter.js`),
to: join(resolve('docs'), 'vendor'),
flatten: true
}
];
const assets = [{
from: resolve('./styles.css'),
to: join(resolve('docs'))
}, {
from: resolve('./assets'),
to: join(resolve('docs/assets'))
}]
module.exports = {
mode: 'production',
entry: './index.js',
output: {
path: __dirname + '/docs'
},
devServer: {
contentBase: './docs'
},
plugins: [
new CopyWebpackPlugin([...polyfills, ...elements, ...assets]),
new HtmlWebpackPlugin({
template: './index.html',
favicon: './favicon.ico'
})
]
};