forked from bigcommerce/stencil-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
81 lines (74 loc) · 2.12 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
var LiveReloadPlugin = require('webpack-livereload-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var Path = require('path');
var distPath = Path.join(__dirname, 'server/plugins/stencil-editor/public/dist');
// Icons used from pattern lab
var icons = [
'ic-add',
'ic-arrow-drop-up',
'ic-arrow-drop-down',
'ic-chevron-left',
'ic-chevron-right',
'ic-delete',
'ic-remove',
'ic-phone-iphone',
'ic-tablet-mac',
'ic-desktop-windows',
'ic-check-circle',
'ic-close',
'ic-refresh',
].join(',');
var config = {
devtool: 'inline-source-map',
watch: true,
entry: {
app: './server/plugins/stencil-editor/js/app.js',
},
output: {
filename: '[name].js',
path: distPath,
},
module: {
loaders: [{
test: /\.js$/,
exclude: /(node_modules|ng-stencil-editor)/,
loader: 'babel?presets[]=es2015',
}],
},
plugins: [
new CleanWebpackPlugin(['*'], {
root: distPath,
}),
new LiveReloadPlugin({
appendScriptTag: true,
host: 'localhost',
}),
new CopyWebpackPlugin([{
context: 'node_modules/bcapp-pattern-lab/dist',
from: 'svg/icons/{' + icons + '}.svg',
to: Path.join(distPath, 'bcapp-pattern-lab'),
},
{
context: 'node_modules/bcapp-pattern-lab/dist',
from: 'css/**/*.css',
to: Path.join(distPath, 'bcapp-pattern-lab'),
},
{
context: 'node_modules/ng-stencil-editor/dist',
from: '**/*.{css,svg}',
to: Path.join(distPath, 'ng-stencil-editor'),
},
{
context: 'node_modules/stencil-preview-sdk/dist',
from: 'js/stencil-preview-sdk.js',
to: distPath,
},
]),
],
};
if (process.argv.indexOf('--deploy') > 0) {
config.devtool = null;
config.watch = false;
}
module.exports = config;