-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
83 lines (73 loc) · 1.89 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
const path = require('path')
const fs = require('fs')
const srcPath = path.join(__dirname, 'src') + path.sep
const outputPath = path.join(__dirname, 'build')
const widgetWebpack = require('materia-widget-development-kit/webpack-widget')
const rules = widgetWebpack.getDefaultRules()
const entries = widgetWebpack.getDefaultEntries()
const copy = widgetWebpack.getDefaultCopyList()
const customCopy = copy.concat([
{
from: path.join(__dirname, 'node_modules', 'angular-sortable-view', 'src', 'angular-sortable-view.min.js'),
to: path.join(outputPath, 'vendor'),
},
{
from: path.join(__dirname, 'src','_guides','assets'),
to: path.join(__dirname, 'build','guides','assets'),
toType: 'dir'
}
])
entries['scorescreen.js'] = [
srcPath+'scorescreen.coffee'
]
entries['scorescreen.css'] = [
srcPath+'scorescreen.html',
srcPath+'scorescreen.scss'
]
entries['guides/creator.temp.html'] = [
srcPath+'_guides/creator.md'
]
entries['guides/player.temp.html'] = [
srcPath+'_guides/player.md'
]
// this is needed to prevent html-loader from causing issues with
// style tags in the player using angular
let customHTMLAndReplaceRule = {
test: /\.html$/i,
exclude: /node_modules/,
use: [
{
loader: 'file-loader',
options: { name: '[name].html' }
},
{
loader: 'extract-loader'
},
{
loader: 'string-replace-loader',
options: { multiple: widgetWebpack.materiaJSReplacements }
},
{
loader: 'html-loader',
options: {
minifyCSS: false
}
}
]
}
let customRules = [
rules.loaderDoNothingToJs,
rules.loaderCompileCoffee,
rules.copyImages,
customHTMLAndReplaceRule, // <--- replaces "rules.loadHTMLAndReplaceMateriaScripts"
rules.loadAndPrefixCSS,
rules.loadAndPrefixSASS,
rules.loadAndCompileMarkdown
]
// options for the build
let options = {
entries: entries,
copyList: customCopy,
moduleRules: customRules
}
module.exports = widgetWebpack.getLegacyWidgetBuildConfig(options)