forked from mozilla/protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.docs.static.config.js
75 lines (70 loc) · 2.24 KB
/
webpack.docs.static.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
/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
/* eslint-env node, commonjs, es2017 */
const CopyPlugin = require('copy-webpack-plugin');
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const protocolStatic = {
// main.js serves as an entrypoint for Webpack, but is not required
// directly by any Protocol components.
entry: path.resolve(__dirname, 'main.js'),
output: {
path: path.resolve(__dirname, 'static/protocol')
},
performance: {
hints: 'warning'
},
devtool: false,
plugins: [
// Clean out ./static/protocol directory before processing.
new CleanWebpackPlugin(),
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'assets/fonts/'),
to: 'fonts/'
},
{
from: path.resolve(__dirname, 'node_modules/@mozilla-protocol/tokens/dist/'),
to: 'css/includes/tokens/dist/'
},
{
from: path.resolve(__dirname, 'node_modules/@mozilla-protocol/assets/'),
to: 'img/'
}
]
})
]
};
const fractalStatic = {
// main.js serves as an entrypoint for Webpack, but is not required
// directly by any Protocol components.
entry: path.resolve(__dirname, 'main.js'),
output: {
path: path.resolve(__dirname, 'theme/static')
},
performance: {
hints: 'warning'
},
devtool: false,
plugins: [
// Clean out ./theme/static directory before processing.
new CleanWebpackPlugin(),
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'theme/assets/img'),
to: 'img/'
},
{
from: path.resolve(__dirname, 'theme/assets/favicon.png'),
to: 'favicon.png'
},
]
})
]
};
module.exports = [protocolStatic, fractalStatic];