-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
30 lines (24 loc) · 1.04 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
var getConfig = require('hjs-webpack');
var isDev = process.env.NODE_ENV !== 'production'
var config = getConfig({
in: 'src/index.ts',
out: 'public',
clearBeforeBuild: true,
isDev: isDev,
html: function (context) {
return {
'index.html': getIndexHtml(context, isDev)
}
}
});
function getIndexHtml(context, isDev) {
var html = context.defaultTemplate()
.replace('<div id="root"></div>', '<section id="root" class="todoapp"></section><footer class="info"><p>Double-click to edit a todo</p><p><a href="https://github.com/maiermic/todomvc-cycle-typescript">Source code</a></p><p>Created by <a href="http://andre.staltz.com">Andre Staltz</a></p><p>Ported to TypeScript by <a href="https://github.com/maiermic">Michael Maier</a></p></footer>')
if (!isDev) {
html = html.replace('</head>', '<link rel="stylesheet" href="todomvc-cycle-typescript.1.0.0.css"></head>')
}
return html;
}
config.resolve.extensions = config.resolve.extensions.concat(['.ts', '.tsx']);
config.devtool = 'source-map';
module.exports = config;