summaryrefslogtreecommitdiff
path: root/webpack.common.js
blob: 9f58610c81730a943503833e5b0e70f242fbc1be (plain)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
const webpack = require('webpack')
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')

// Fix possible nofile-issues
const fs = require('fs')
const gracefulFs = require('graceful-fs')
gracefulFs.gracefulify(fs)

module.exports = {
  name: 'app',
  plugins: [
    new webpack.ProvidePlugin({
      Visibility: 'visibilityjs',
      Cookies: 'js-cookie',
      key: 'keymaster',
      $: 'jquery',
      jQuery: 'jquery',
      'window.jQuery': 'jquery',
      'moment': 'moment',
      'Handlebars': 'handlebars'
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/header.ejs',
      chunks: ['font', 'index-styles', 'index'],
      filename: path.join(__dirname, 'public/views/build/index-header.ejs'),
      inject: false,
      chunksSortMode: 'manual'
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/header.ejs',
      chunks: ['font-pack', 'index-styles-pack', 'index-styles', 'index'],
      filename: path.join(__dirname, 'public/views/build/index-pack-header.ejs'),
      inject: false,
      chunksSortMode: 'manual'
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/scripts.ejs',
      chunks: ['index'],
      filename: path.join(__dirname, 'public/views/build/index-scripts.ejs'),
      inject: false
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/scripts.ejs',
      chunks: ['common', 'index-pack'],
      filename: path.join(__dirname, 'public/views/build/index-pack-scripts.ejs'),
      inject: false,
      chunksSortMode: 'manual'
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/header.ejs',
      chunks: ['font', 'cover'],
      filename: path.join(__dirname, 'public/views/build/cover-header.ejs'),
      inject: false,
      chunksSortMode: 'manual'
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/header.ejs',
      chunks: ['font-pack', 'cover-styles-pack', 'cover'],
      filename: path.join(__dirname, 'public/views/build/cover-pack-header.ejs'),
      inject: false,
      chunksSortMode: 'manual'
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/scripts.ejs',
      chunks: ['cover'],
      filename: path.join(__dirname, 'public/views/build/cover-scripts.ejs'),
      inject: false
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/scripts.ejs',
      chunks: ['common', 'cover-pack'],
      filename: path.join(__dirname, 'public/views/build/cover-pack-scripts.ejs'),
      inject: false,
      chunksSortMode: 'manual'
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/header.ejs',
      chunks: ['font', 'pretty-styles', 'pretty'],
      filename: path.join(__dirname, 'public/views/build/pretty-header.ejs'),
      inject: false,
      chunksSortMode: 'manual'
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/header.ejs',
      chunks: ['font-pack', 'pretty-styles-pack', 'pretty-styles', 'pretty'],
      filename: path.join(__dirname, 'public/views/build/pretty-pack-header.ejs'),
      inject: false,
      chunksSortMode: 'manual'
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/scripts.ejs',
      chunks: ['pretty'],
      filename: path.join(__dirname, 'public/views/build/pretty-scripts.ejs'),
      inject: false
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/scripts.ejs',
      chunks: ['common', 'pretty-pack'],
      filename: path.join(__dirname, 'public/views/build/pretty-pack-scripts.ejs'),
      inject: false,
      chunksSortMode: 'manual'
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/header.ejs',
      chunks: ['font', 'slide-styles', 'slide'],
      filename: path.join(__dirname, 'public/views/build/slide-header.ejs'),
      inject: false,
      chunksSortMode: 'manual'
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/header.ejs',
      chunks: ['font-pack', 'slide-styles-pack', 'slide-styles', 'slide'],
      filename: path.join(__dirname, 'public/views/build/slide-pack-header.ejs'),
      inject: false,
      chunksSortMode: 'manual'
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/scripts.ejs',
      chunks: ['slide'],
      filename: path.join(__dirname, 'public/views/build/slide-scripts.ejs'),
      inject: false
    }),
    new HtmlWebpackPlugin({
      template: 'public/views/includes/scripts.ejs',
      chunks: ['slide-pack'],
      filename: path.join(__dirname, 'public/views/build/slide-pack-scripts.ejs'),
      inject: false
    }),
    new CopyWebpackPlugin({
      patterns: [
        {
          context: path.join(__dirname, 'node_modules/mathjax/unpacked'),
          from: '**/*',
          globOptions: {
            dot: false
          },
          to: 'MathJax/'
        },
        {
          context: path.join(__dirname, 'node_modules/mathjax/fonts'),
          from: '**/*',
          globOptions: {
            dot: false
          },
          to: 'fonts/'
        },
        {
          context: path.join(__dirname, 'node_modules/emojify.js'),
          from: 'dist/**/*',
          globOptions: {
            dot: false
          },
          to: 'emojify.js/'
        },
        {
          context: path.join(__dirname, 'node_modules/reveal.js'),
          from: 'js',
          to: 'reveal.js/js'
        },
        {
          context: path.join(__dirname, 'node_modules/reveal.js'),
          from: 'css',
          to: 'reveal.js/css'
        },
        {
          context: path.join(__dirname, 'node_modules/reveal.js'),
          from: 'lib',
          to: 'reveal.js/lib'
        },
        {
          context: path.join(__dirname, 'node_modules/reveal.js'),
          from: 'plugin',
          to: 'reveal.js/plugin'
        }
      ]
    }),
    new MiniCssExtractPlugin()
  ],

  entry: {
    font: path.join(__dirname, 'public/css/google-font.css'),
    'font-pack': path.join(__dirname, 'public/css/font.css'),
    common: [
      'expose-loader?jQuery!expose-loader?$!jquery',
      'velocity-animate',
      'imports-loader?$=jquery!jquery-mousewheel',
      'bootstrap'
    ],
    cover: [
      'babel-polyfill',
      path.join(__dirname, 'public/js/cover.js')
    ],
    'cover-styles-pack': [
      path.join(__dirname, 'node_modules/bootstrap/dist/css/bootstrap.min.css'),
      path.join(__dirname, 'node_modules/fork-awesome/css/fork-awesome.min.css'),
      path.join(__dirname, 'public/css/bootstrap-social.css'),
      path.join(__dirname, 'node_modules/select2/select2.css'),
      path.join(__dirname, 'node_modules/select2/select2-bootstrap.css')
    ],
    'cover-pack': [
      'babel-polyfill',
      'bootstrap-validator',
      'expose-loader?select2!select2',
      'expose-loader?moment!moment',
      path.join(__dirname, 'public/js/cover.js')
    ],
    index: [
      'babel-polyfill',
      'script-loader!jquery-ui-resizable',
      'script-loader!Idle.Js',
      'expose-loader?LZString!lz-string',

      'script-loader!codemirror-lib-codemirror',
      'script-loader!codemirror-addon-mode-overlay',
      'script-loader!codemirror-addon-mode-simple',
      'script-loader!codemirror-addon-mode-multiplex',
      'script-loader!codemirror-addon-selection-active-line',
      'script-loader!codemirror-addon-search-searchcursor',
      'script-loader!codemirror-addon-search-search',
      'script-loader!codemirror-addon-search-jump-to-line',
      'script-loader!codemirror-addon-search-matchesonscrollbar',
      'script-loader!codemirror-addon-search-match-highlighter',
      'script-loader!codemirror-addon-scroll-simplescrollbars',
      'script-loader!codemirror-addon-scroll-annotatescrollbar',
      'script-loader!codemirror-addon-display-panel',
      'script-loader!codemirror-addon-display-placeholder',
      'script-loader!codemirror-addon-display-fullscreen',
      'script-loader!codemirror-addon-display-autorefresh',
      'script-loader!codemirror-addon-dialog-dialog',
      'script-loader!codemirror-addon-edit-matchbrackets',
      'script-loader!codemirror-addon-edit-closebrackets',
      'script-loader!codemirror-addon-edit-matchtags',
      'script-loader!codemirror-addon-edit-closetag',
      'script-loader!codemirror-addon-edit-continuelist',
      'script-loader!codemirror-addon-comment-comment',
      'script-loader!codemirror-addon-comment-continuecomment',
      'script-loader!codemirror-addon-wrap-hardwrap',
      'script-loader!codemirror-addon-fold-foldcode',
      'script-loader!codemirror-addon-fold-brace-fold',
      'script-loader!codemirror-addon-fold-foldgutter',
      'script-loader!codemirror-addon-fold-markdown-fold',
      'script-loader!codemirror-addon-fold-xml-fold',
      'script-loader!codemirror-addon-merge-merge',
      'script-loader!codemirror-mode-xml-xml',
      'script-loader!codemirror-mode-markdown-markdown_math',
      'script-loader!codemirror-mode-gfm-gfm',
      'script-loader!codemirror-mode-javascript-javascript',
      'script-loader!codemirror-mode-typescript-typescript',
      'script-loader!codemirror-mode-jsx-jsx',
      'script-loader!codemirror-mode-css-css',
      'script-loader!codemirror-mode-htmlmixed-htmlmixed',
      'script-loader!codemirror-mode-htmlembedded-htmlembedded',
      'script-loader!codemirror-mode-clike-clike',
      'script-loader!codemirror-mode-clojure-clojure',
      'script-loader!codemirror-mode-diff-diff',
      'script-loader!codemirror-mode-ruby-ruby',
      'script-loader!codemirror-mode-rust-rust',
      'script-loader!codemirror-mode-python-python',
      'script-loader!codemirror-mode-plantuml-plantuml',
      'script-loader!codemirror-mode-csv-csv',
      'script-loader!codemirror-mode-shell-shell',
      'script-loader!codemirror-mode-php-php',
      'script-loader!codemirror-mode-sas-sas',
      'script-loader!codemirror-mode-stex-stex',
      'script-loader!codemirror-mode-sql-sql',
      'script-loader!codemirror-mode-haskell-haskell',
      'script-loader!codemirror-mode-coffeescript-coffeescript',
      'script-loader!codemirror-mode-yaml-yaml',
      'script-loader!codemirror-mode-yaml-frontmatter-yaml-frontmatter',
      'script-loader!codemirror-mode-pug-pug',
      'script-loader!codemirror-mode-lua-lua',
      'script-loader!codemirror-mode-cmake-cmake',
      'script-loader!codemirror-mode-nginx-nginx',
      'script-loader!codemirror-mode-perl-perl',
      'script-loader!codemirror-mode-sass-sass',
      'script-loader!codemirror-mode-r-r',
      'script-loader!codemirror-mode-dockerfile-dockerfile',
      'script-loader!codemirror-mode-tiddlywiki-tiddlywiki',
      'script-loader!codemirror-mode-mediawiki-mediawiki',
      'script-loader!codemirror-mode-go-go',
      'script-loader!codemirror-mode-graphviz-graphviz',
      'script-loader!codemirror-mode-groovy-groovy',
      'script-loader!codemirror-mode-gherkin-gherkin',
      'script-loader!codemirror-mode-mllike-mllike',
      'script-loader!codemirror-keymap-emacs',
      'script-loader!codemirror-keymap-sublime',
      'script-loader!codemirror-keymap-vim',

      'script-loader!inlineAttachment',
      'script-loader!jqueryTextcomplete',
      'script-loader!codemirrorSpellChecker',
      'script-loader!codemirrorInlineAttachment',
      'script-loader!ot',
      'flowchart.js',
      'js-sequence-diagrams',
      'expose-loader?RevealMarkdown!reveal-markdown',
      path.join(__dirname, 'public/js/index.js')
    ],
    'index-styles': [
      path.join(__dirname, 'public/vendor/jquery-ui/jquery-ui.min.css'),
      path.join(__dirname, 'public/vendor/codemirror-spell-checker/spell-checker.min.css'),
      path.join(__dirname, 'node_modules/codemirror/lib/codemirror.css'),
      path.join(__dirname, 'node_modules/codemirror/addon/fold/foldgutter.css'),
      path.join(__dirname, 'node_modules/codemirror/addon/display/fullscreen.css'),
      path.join(__dirname, 'node_modules/codemirror/addon/dialog/dialog.css'),
      path.join(__dirname, 'node_modules/codemirror/addon/scroll/simplescrollbars.css'),
      path.join(__dirname, 'node_modules/codemirror/addon/search/matchesonscrollbar.css'),
      path.join(__dirname, 'node_modules/codemirror/theme/monokai.css'),
      path.join(__dirname, 'node_modules/codemirror/theme/one-dark.css'),
      path.join(__dirname, 'node_modules/codemirror/mode/tiddlywiki/tiddlywiki.css'),
      path.join(__dirname, 'node_modules/codemirror/mode/mediawiki/mediawiki.css'),
      path.join(__dirname, 'public/css/github-extract.css'),
      path.join(__dirname, 'public/vendor/showup/showup.css'),
      path.join(__dirname, 'public/css/mermaid.css'),
      path.join(__dirname, 'public/css/markdown.css'),
      path.join(__dirname, 'public/css/slide-preview.css')
    ],
    'index-styles-pack': [
      path.join(__dirname, 'node_modules/bootstrap/dist/css/bootstrap.min.css'),
      path.join(__dirname, 'node_modules/fork-awesome/css/fork-awesome.min.css'),
      path.join(__dirname, 'public/css/bootstrap-social.css'),
      path.join(__dirname, 'node_modules/ionicons/css/ionicons.min.css')
    ],
    'index-pack': [
      'babel-polyfill',
      'expose-loader?Spinner!spin.js',
      'script-loader!jquery-ui-resizable',
      'bootstrap-validator',
      'expose-loader?jsyaml!js-yaml',
      'script-loader!mermaid',
      'expose-loader?moment!moment',
      'script-loader!handlebars',
      'expose-loader?hljs!highlight.js',
      'expose-loader?emojify!emojify.js',
      'script-loader!Idle.Js',
      'script-loader!gist-embed',
      'expose-loader?LZString!lz-string',

      'script-loader!codemirror-lib-codemirror',
      'script-loader!codemirror-addon-mode-overlay',
      'script-loader!codemirror-addon-mode-simple',
      'script-loader!codemirror-addon-mode-multiplex',
      'script-loader!codemirror-addon-selection-active-line',
      'script-loader!codemirror-addon-search-searchcursor',
      'script-loader!codemirror-addon-search-search',
      'script-loader!codemirror-addon-search-jump-to-line',
      'script-loader!codemirror-addon-search-matchesonscrollbar',
      'script-loader!codemirror-addon-search-match-highlighter',
      'script-loader!codemirror-addon-scroll-simplescrollbars',
      'script-loader!codemirror-addon-scroll-annotatescrollbar',
      'script-loader!codemirror-addon-display-panel',
      'script-loader!codemirror-addon-display-placeholder',
      'script-loader!codemirror-addon-display-fullscreen',
      'script-loader!codemirror-addon-display-autorefresh',
      'script-loader!codemirror-addon-dialog-dialog',
      'script-loader!codemirror-addon-edit-matchbrackets',
      'script-loader!codemirror-addon-edit-closebrackets',
      'script-loader!codemirror-addon-edit-matchtags',
      'script-loader!codemirror-addon-edit-closetag',
      'script-loader!codemirror-addon-edit-continuelist',
      'script-loader!codemirror-addon-comment-comment',
      'script-loader!codemirror-addon-comment-continuecomment',
      'script-loader!codemirror-addon-wrap-hardwrap',
      'script-loader!codemirror-addon-fold-foldcode',
      'script-loader!codemirror-addon-fold-brace-fold',
      'script-loader!codemirror-addon-fold-foldgutter',
      'script-loader!codemirror-addon-fold-markdown-fold',
      'script-loader!codemirror-addon-fold-xml-fold',
      'script-loader!codemirror-addon-merge-merge',
      'script-loader!codemirror-mode-xml-xml',
      'script-loader!codemirror-mode-markdown-markdown_math',
      'script-loader!codemirror-mode-gfm-gfm',
      'script-loader!codemirror-mode-javascript-javascript',
      'script-loader!codemirror-mode-typescript-typescript',
      'script-loader!codemirror-mode-jsx-jsx',
      'script-loader!codemirror-mode-css-css',
      'script-loader!codemirror-mode-htmlmixed-htmlmixed',
      'script-loader!codemirror-mode-htmlembedded-htmlembedded',
      'script-loader!codemirror-mode-clike-clike',
      'script-loader!codemirror-mode-clojure-clojure',
      'script-loader!codemirror-mode-diff-diff',
      'script-loader!codemirror-mode-ruby-ruby',
      'script-loader!codemirror-mode-rust-rust',
      'script-loader!codemirror-mode-python-python',
      'script-loader!codemirror-mode-plantuml-plantuml',
      'script-loader!codemirror-mode-csv-csv',
      'script-loader!codemirror-mode-shell-shell',
      'script-loader!codemirror-mode-php-php',
      'script-loader!codemirror-mode-sas-sas',
      'script-loader!codemirror-mode-stex-stex',
      'script-loader!codemirror-mode-sql-sql',
      'script-loader!codemirror-mode-haskell-haskell',
      'script-loader!codemirror-mode-coffeescript-coffeescript',
      'script-loader!codemirror-mode-yaml-yaml',
      'script-loader!codemirror-mode-yaml-frontmatter-yaml-frontmatter',
      'script-loader!codemirror-mode-pug-pug',
      'script-loader!codemirror-mode-lua-lua',
      'script-loader!codemirror-mode-cmake-cmake',
      'script-loader!codemirror-mode-nginx-nginx',
      'script-loader!codemirror-mode-perl-perl',
      'script-loader!codemirror-mode-sass-sass',
      'script-loader!codemirror-mode-r-r',
      'script-loader!codemirror-mode-dockerfile-dockerfile',
      'script-loader!codemirror-mode-tiddlywiki-tiddlywiki',
      'script-loader!codemirror-mode-mediawiki-mediawiki',
      'script-loader!codemirror-mode-go-go',
      'script-loader!codemirror-mode-graphviz-graphviz',
      'script-loader!codemirror-mode-groovy-groovy',
      'script-loader!codemirror-mode-gherkin-gherkin',
      'script-loader!codemirror-mode-mllike-mllike',
      'script-loader!codemirror-keymap-emacs',
      'script-loader!codemirror-keymap-sublime',
      'script-loader!codemirror-keymap-vim',

      'script-loader!inlineAttachment',
      'script-loader!jqueryTextcomplete',
      'script-loader!codemirrorSpellChecker',
      'script-loader!codemirrorInlineAttachment',
      'script-loader!ot',
      'flowchart.js',
      'js-sequence-diagrams',
      'expose-loader?Viz!viz.js',
      'script-loader!abcjs',
      'expose-loader?io!socket.io-client',
      'expose-loader?RevealMarkdown!reveal-markdown',
      path.join(__dirname, 'public/js/index.js')
    ],
    pretty: [
      'babel-polyfill',
      'flowchart.js',
      'js-sequence-diagrams',
      'expose-loader?RevealMarkdown!reveal-markdown',
      path.join(__dirname, 'public/js/pretty.js')
    ],
    'pretty-styles': [
      path.join(__dirname, 'public/css/github-extract.css'),
      path.join(__dirname, 'public/css/mermaid.css'),
      path.join(__dirname, 'public/css/markdown.css'),
      path.join(__dirname, 'public/css/slide-preview.css')
    ],
    'pretty-styles-pack': [
      path.join(__dirname, 'node_modules/bootstrap/dist/css/bootstrap.min.css'),
      path.join(__dirname, 'node_modules/fork-awesome/css/fork-awesome.min.css'),
      path.join(__dirname, 'node_modules/ionicons/css/ionicons.min.css')
    ],
    'pretty-pack': [
      'babel-polyfill',
      'expose-loader?jsyaml!js-yaml',
      'script-loader!mermaid',
      'expose-loader?moment!moment',
      'script-loader!handlebars',
      'expose-loader?hljs!highlight.js',
      'expose-loader?emojify!emojify.js',
      'script-loader!gist-embed',
      'flowchart.js',
      'js-sequence-diagrams',
      'expose-loader?Viz!viz.js',
      'script-loader!abcjs',
      'expose-loader?RevealMarkdown!reveal-markdown',
      path.join(__dirname, 'public/js/pretty.js')
    ],
    slide: [
      'babel-polyfill',
      'bootstrap-tooltip',
      'flowchart.js',
      'js-sequence-diagrams',
      'expose-loader?RevealMarkdown!reveal-markdown',
      path.join(__dirname, 'public/js/slide.js')
    ],
    'slide-styles': [
      path.join(__dirname, 'public/vendor/bootstrap/tooltip.min.css'),
      path.join(__dirname, 'public/css/github-extract.css'),
      path.join(__dirname, 'public/css/mermaid.css'),
      path.join(__dirname, 'public/css/markdown.css')
    ],
    'slide-styles-pack': [
      path.join(__dirname, 'node_modules/fork-awesome/css/fork-awesome.min.css'),
      path.join(__dirname, 'node_modules/ionicons/css/ionicons.min.css')
    ],
    'slide-pack': [
      'babel-polyfill',
      'expose-loader?jQuery!expose-loader?$!jquery',
      'velocity-animate',
      'imports-loader?$=jquery!jquery-mousewheel',
      'bootstrap-tooltip',
      'expose-loader?jsyaml!js-yaml',
      'script-loader!mermaid',
      'expose-loader?moment!moment',
      'script-loader!handlebars',
      'expose-loader?hljs!highlight.js',
      'expose-loader?emojify!emojify.js',
      'script-loader!gist-embed',
      'flowchart.js',
      'js-sequence-diagrams',
      'expose-loader?Viz!viz.js',
      'script-loader!abcjs',
      'expose-loader?Reveal!reveal.js',
      'expose-loader?RevealMarkdown!reveal-markdown',
      path.join(__dirname, 'public/js/slide.js')
    ]
  },

  output: {
    path: path.join(__dirname, 'public/build'),
    publicPath: 'build/',
    filename: '[name].js'
  },

  resolve: {
    modules: ['node_modules'],
    extensions: ['.js'],
    alias: {
      'codemirror-lib-codemirror': path.join(__dirname, 'node_modules/codemirror/lib/codemirror.js'),
      'codemirror-addon-mode-overlay': path.join(__dirname, 'node_modules/codemirror/addon/mode/overlay.js'),
      'codemirror-addon-mode-simple': path.join(__dirname, 'node_modules/codemirror/addon/mode/simple.js'),
      'codemirror-addon-mode-multiplex': path.join(__dirname, 'node_modules/codemirror/addon/mode/multiplex.js'),
      'codemirror-addon-selection-active-line': path.join(__dirname, 'node_modules/codemirror/addon/selection/active-line.js'),
      'codemirror-addon-search-searchcursor': path.join(__dirname, 'node_modules/codemirror/addon/search/searchcursor.js'),
      'codemirror-addon-search-search': path.join(__dirname, 'node_modules/codemirror/addon/search/search.js'),
      'codemirror-addon-search-jump-to-line': path.join(__dirname, 'node_modules/codemirror/addon/search/jump-to-line.js'),
      'codemirror-addon-search-matchesonscrollbar': path.join(__dirname, 'node_modules/codemirror/addon/search/matchesonscrollbar.js'),
      'codemirror-addon-search-match-highlighter': path.join(__dirname, 'node_modules/codemirror/addon/search/match-highlighter.js'),
      'codemirror-addon-scroll-simplescrollbars': path.join(__dirname, 'node_modules/codemirror/addon/scroll/simplescrollbars.js'),
      'codemirror-addon-scroll-annotatescrollbar': path.join(__dirname, 'node_modules/codemirror/addon/scroll/annotatescrollbar.js'),
      'codemirror-addon-display-panel': path.join(__dirname, 'node_modules/codemirror/addon/display/panel.js'),
      'codemirror-addon-display-placeholder': path.join(__dirname, 'node_modules/codemirror/addon/display/placeholder.js'),
      'codemirror-addon-display-fullscreen': path.join(__dirname, 'node_modules/codemirror/addon/display/fullscreen.js'),
      'codemirror-addon-display-autorefresh': path.join(__dirname, 'node_modules/codemirror/addon/display/autorefresh.js'),
      'codemirror-addon-dialog-dialog': path.join(__dirname, 'node_modules/codemirror/addon/dialog/dialog.js'),
      'codemirror-addon-edit-matchbrackets': path.join(__dirname, 'node_modules/codemirror/addon/edit/matchbrackets.js'),
      'codemirror-addon-edit-closebrackets': path.join(__dirname, 'node_modules/codemirror/addon/edit/closebrackets.js'),
      'codemirror-addon-edit-matchtags': path.join(__dirname, 'node_modules/codemirror/addon/edit/matchtags.js'),
      'codemirror-addon-edit-closetag': path.join(__dirname, 'node_modules/codemirror/addon/edit/closetag.js'),
      'codemirror-addon-edit-continuelist': path.join(__dirname, 'node_modules/codemirror/addon/edit/continuelist.js'),
      'codemirror-addon-comment-comment': path.join(__dirname, 'node_modules/codemirror/addon/comment/comment.js'),
      'codemirror-addon-comment-continuecomment': path.join(__dirname, 'node_modules/codemirror/addon/comment/continuecomment.js'),
      'codemirror-addon-wrap-hardwrap': path.join(__dirname, 'node_modules/codemirror/addon/wrap/hardwrap.js'),
      'codemirror-addon-fold-foldcode': path.join(__dirname, 'node_modules/codemirror/addon/fold/foldcode.js'),
      'codemirror-addon-fold-brace-fold': path.join(__dirname, 'node_modules/codemirror/addon/fold/brace-fold.js'),
      'codemirror-addon-fold-foldgutter': path.join(__dirname, 'node_modules/codemirror/addon/fold/foldgutter.js'),
      'codemirror-addon-fold-markdown-fold': path.join(__dirname, 'node_modules/codemirror/addon/fold/markdown-fold.js'),
      'codemirror-addon-fold-xml-fold': path.join(__dirname, 'node_modules/codemirror/addon/fold/xml-fold.js'),
      'codemirror-addon-merge-merge': path.join(__dirname, 'node_modules/codemirror/addon/merge/merge.js'),
      'codemirror-mode-xml-xml': path.join(__dirname, 'node_modules/codemirror/mode/xml/xml.js'),
      'codemirror-mode-markdown-markdown_math': path.join(__dirname, 'node_modules/codemirror/mode/markdown/markdown_math.js'),
      'codemirror-mode-gfm-gfm': path.join(__dirname, 'node_modules/codemirror/mode/gfm/gfm.js'),
      'codemirror-mode-javascript-javascript': path.join(__dirname, 'node_modules/codemirror/mode/javascript/javascript.js'),
      'codemirror-mode-typescript-typescript': path.join(__dirname, 'node_modules/codemirror/mode/typescript/typescript.js'),
      'codemirror-mode-jsx-jsx': path.join(__dirname, 'node_modules/codemirror/mode/jsx/jsx.js'),
      'codemirror-mode-css-css': path.join(__dirname, 'node_modules/codemirror/mode/css/css.js'),
      'codemirror-mode-htmlmixed-htmlmixed': path.join(__dirname, 'node_modules/codemirror/mode/htmlmixed/htmlmixed.js'),
      'codemirror-mode-htmlembedded-htmlembedded': path.join(__dirname, 'node_modules/codemirror/mode/htmlembedded/htmlembedded.js'),
      'codemirror-mode-clike-clike': path.join(__dirname, 'node_modules/codemirror/mode/clike/clike.js'),
      'codemirror-mode-clojure-clojure': path.join(__dirname, 'node_modules/codemirror/mode/clojure/clojure.js'),
      'codemirror-mode-diff-diff': path.join(__dirname, 'node_modules/codemirror/mode/diff/diff.js'),
      'codemirror-mode-ruby-ruby': path.join(__dirname, 'node_modules/codemirror/mode/ruby/ruby.js'),
      'codemirror-mode-rust-rust': path.join(__dirname, 'node_modules/codemirror/mode/rust/rust.js'),
      'codemirror-mode-python-python': path.join(__dirname, 'node_modules/codemirror/mode/python/python.js'),
      'codemirror-mode-plantuml-plantuml': path.join(__dirname, 'node_modules/codemirror/mode/plantuml/plantuml.js'),
      'codemirror-mode-csv-csv': path.join(__dirname, 'node_modules/codemirror/mode/csv/csv.js'),
      'codemirror-mode-shell-shell': path.join(__dirname, 'node_modules/codemirror/mode/shell/shell.js'),
      'codemirror-mode-php-php': path.join(__dirname, 'node_modules/codemirror/mode/php/php.js'),
      'codemirror-mode-sas-sas': path.join(__dirname, 'node_modules/codemirror/mode/sas/sas.js'),
      'codemirror-mode-stex-stex': path.join(__dirname, 'node_modules/codemirror/mode/stex/stex.js'),
      'codemirror-mode-sql-sql': path.join(__dirname, 'node_modules/codemirror/mode/sql/sql.js'),
      'codemirror-mode-haskell-haskell': path.join(__dirname, 'node_modules/codemirror/mode/haskell/haskell.js'),
      'codemirror-mode-coffeescript-coffeescript': path.join(__dirname, 'node_modules/codemirror/mode/coffeescript/coffeescript.js'),
      'codemirror-mode-yaml-yaml': path.join(__dirname, 'node_modules/codemirror/mode/yaml/yaml.js'),
      'codemirror-mode-yaml-frontmatter-yaml-frontmatter': path.join(__dirname, 'node_modules/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js'),
      'codemirror-mode-pug-pug': path.join(__dirname, 'node_modules/codemirror/mode/pug/pug.js'),
      'codemirror-mode-lua-lua': path.join(__dirname, 'node_modules/codemirror/mode/lua/lua.js'),
      'codemirror-mode-cmake-cmake': path.join(__dirname, 'node_modules/codemirror/mode/cmake/cmake.js'),
      'codemirror-mode-nginx-nginx': path.join(__dirname, 'node_modules/codemirror/mode/nginx/nginx.js'),
      'codemirror-mode-perl-perl': path.join(__dirname, 'node_modules/codemirror/mode/perl/perl.js'),
      'codemirror-mode-sass-sass': path.join(__dirname, 'node_modules/codemirror/mode/sass/sass.js'),
      'codemirror-mode-r-r': path.join(__dirname, 'node_modules/codemirror/mode/r/r.js'),
      'codemirror-mode-dockerfile-dockerfile': path.join(__dirname, 'node_modules/codemirror/mode/dockerfile/dockerfile.js'),
      'codemirror-mode-tiddlywiki-tiddlywiki': path.join(__dirname, 'node_modules/codemirror/mode/tiddlywiki/tiddlywiki.js'),
      'codemirror-mode-mediawiki-mediawiki': path.join(__dirname, 'node_modules/codemirror/mode/mediawiki/mediawiki.js'),
      'codemirror-mode-go-go': path.join(__dirname, 'node_modules/codemirror/mode/go/go.js'),
      'codemirror-mode-graphviz-graphviz': path.join(__dirname, 'node_modules/codemirror/mode/graphviz/graphviz.js'),
      'codemirror-mode-groovy-groovy': path.join(__dirname, 'node_modules/codemirror/mode/groovy/groovy.js'),
      'codemirror-mode-gherkin-gherkin': path.join(__dirname, 'node_modules/codemirror/mode/gherkin/gherkin.js'),
      'codemirror-mode-mllike-mllike': path.join(__dirname, 'node_modules/codemirror/mode/mllike/mllike.js'),
      'codemirror-keymap-emacs': path.join(__dirname, 'node_modules/codemirror/keymap/emacs.js'),
      'codemirror-keymap-sublime': path.join(__dirname, 'node_modules/codemirror/keymap/sublime.js'),
      'codemirror-keymap-vim': path.join(__dirname, 'node_modules/codemirror/keymap/vim.js'),

      inlineAttachment: path.join(__dirname, 'public/vendor/inlineAttachment/inline-attachment.js'),
      jqueryTextcomplete: path.join(__dirname, 'public/vendor/jquery-textcomplete/jquery.textcomplete.js'),
      codemirrorSpellChecker: path.join(__dirname, 'public/vendor/codemirror-spell-checker/spell-checker.min.js'),
      codemirrorInlineAttachment: path.join(__dirname, 'public/vendor/inlineAttachment/codemirror.inline-attachment.js'),
      ot: path.join(__dirname, 'public/vendor/ot/ot.min.js'),
      mermaid: path.join(__dirname, 'node_modules/mermaid/dist/mermaid.min.js'),
      handlebars: path.join(__dirname, 'node_modules/handlebars/dist/handlebars.min.js'),
      'jquery-ui-resizable': path.join(__dirname, 'public/vendor/jquery-ui/jquery-ui.min.js'),
      'gist-embed': path.join(__dirname, 'node_modules/gist-embed/gist-embed.min.js'),
      'bootstrap-tooltip': path.join(__dirname, 'public/vendor/bootstrap/tooltip.min.js'),
      'reveal-markdown': path.join(__dirname, 'public/js/reveal-markdown.js'),
      abcjs: path.join(__dirname, 'public/vendor/abcjs_basic_3.1.1-min.js'),
      raphael: path.join(__dirname, 'node_modules/raphael/raphael.no-deps.js')
    }
  },

  externals: {
    'viz.js': 'Viz',
    'socket.io-client': 'io',
    'jquery': '$',
    'moment': 'moment',
    'handlebars': 'Handlebars',
    'highlight.js': 'hljs',
    'select2': 'select2'
  },

  module: {
    rules: [{
      test: /\.js$/,
      use: [{ loader: 'babel-loader' }],
      exclude: [/node_modules/, /public\/vendor/]
    }, {
      test: /\.css$/,
      use: [
        {
          loader: MiniCssExtractPlugin.loader,
          options: {
            publicPath: '',
          }
        },
        'css-loader'
      ]
    }, {
      test: /\.less$/,
      use: [
        MiniCssExtractPlugin.loader,
        {
          loader: 'css-loader',
          options: {
            importLoaders: 1
          }
        },
        'less-loader'
      ]
    }, {
      test: require.resolve('js-sequence-diagrams'),
      use: [{
        loader: 'imports-loader',
        options: { _: 'lodash', Raphael: 'raphael', eve: 'eve' }
      }]
    }, {
      test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
      use: [{ loader: 'file-loader' }]
    }, {
      test: /\.html$/,
      use: [{ loader: 'string-loader' }]
    }, {
      test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/,
      use: [{
        loader: 'url-loader',
        options: { prefix: 'font/', limit: '5000' }
      }]
    }, {
      test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
      use: [{
        loader: 'url-loader',
        options: { limit: '5000', mimetype: 'application/octet-stream' }
      }]
    }, {
      test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
      use: [{
        loader: 'url-loader',
        options: { limit: '10000', mimetype: 'svg+xml' }
      }]
    }, {
      test: /\.png(\?v=\d+\.\d+\.\d+)?$/,
      use: [{
        loader: 'url-loader',
        options: { limit: '10000', mimetype: 'image/png' }
      }]
    }, {
      test: /\.gif(\?v=\d+\.\d+\.\d+)?$/,
      use: [{
        loader: 'url-loader',
        options: { limit: '10000', mimetype: 'image/gif' }
      }]
    }]
  },
  node: {
    fs: 'empty'
  },

  stats: {
    assets: false
  }
}