2017-08-31 02:25:58 -04:00
|
|
|
const Handlebars = require('handlebars');
|
|
|
|
const HandlebarsPlugin = require('handlebars-webpack-plugin');
|
|
|
|
const fs = require('fs');
|
|
|
|
|
2017-08-08 14:23:30 -04:00
|
|
|
module.exports = {
|
|
|
|
devtool: 'inline-source-map',
|
2017-08-25 23:20:45 -04:00
|
|
|
entry: {
|
2017-08-29 22:46:18 -04:00
|
|
|
'3d-demo': "./src/3d-demo.ts",
|
2017-08-29 21:57:43 -04:00
|
|
|
'svg-demo': "./src/svg-demo.ts",
|
|
|
|
'text-demo': "./src/text-demo.ts",
|
2017-08-25 23:20:45 -04:00
|
|
|
},
|
2017-08-08 14:23:30 -04:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2017-08-31 02:25:58 -04:00
|
|
|
test: /src\/[a-zA-Z0-9_-]+\.tsx?$/,
|
2017-08-08 14:23:30 -04:00
|
|
|
use: 'ts-loader',
|
|
|
|
exclude: /node_modules/,
|
2017-08-29 19:04:40 -04:00
|
|
|
},
|
2017-08-08 14:23:30 -04:00
|
|
|
]
|
|
|
|
},
|
|
|
|
resolve: {
|
2017-08-29 19:04:40 -04:00
|
|
|
extensions: [".tsx", ".ts", ".html", ".js"],
|
2017-08-08 14:23:30 -04:00
|
|
|
},
|
|
|
|
output: {
|
2017-08-25 23:20:45 -04:00
|
|
|
filename: "[name].js",
|
2017-08-08 14:23:30 -04:00
|
|
|
path: __dirname,
|
|
|
|
},
|
2017-08-31 02:25:58 -04:00
|
|
|
plugins: [
|
|
|
|
new HandlebarsPlugin({
|
|
|
|
entry: "html/*.hbs",
|
|
|
|
output: "./[name]",
|
|
|
|
partials: ["html/partials/*.hbs"],
|
|
|
|
helpers: {
|
|
|
|
octicon: function(iconName) {
|
|
|
|
const svg = fs.readFileSync(`node_modules/octicons/build/svg/${iconName}.svg`);
|
|
|
|
return new Handlebars.SafeString(svg);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
]
|
2017-08-08 14:23:30 -04:00
|
|
|
}
|