Use html plugin + handle URLs

This commit is contained in:
Misode
2020-06-03 21:39:15 +02:00
parent 575bfb4bc7
commit 65eac13082
9 changed files with 75 additions and 25 deletions

View File

@@ -1,11 +1,12 @@
const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = (env, argv) => ({
entry: './src/app/app.ts',
output: {
path: __dirname + '/public',
path: __dirname + '/dist',
publicPath: argv.mode === 'production' ? '/dev/' : '/',
filename: 'build/bundle.js'
filename: 'js/bundle.js'
},
resolve: {
extensions: ['.ts', '.js']
@@ -20,13 +21,42 @@ module.exports = (env, argv) => ({
patterns: [
{
from: 'src/locales',
to: 'build/locales'
to: 'locales/app'
},
{
from: 'node_modules/minecraft-schemas/src/locales',
to: 'build/locales-schema'
to: 'locales/schema'
},
{
from: 'src/styles',
to: 'styles'
}
]
}),
new HtmlWebpackPlugin({
title: 'Minecraft Generators',
filename: 'index.html',
template: 'src/home.html'
}),
new HtmlWebpackPlugin({
title: 'Loot Table Generator Minecraft',
filename: 'loot-table/index.html',
template: 'src/generator.html'
}),
new HtmlWebpackPlugin({
title: 'Predicate Generator Minecraft',
filename: 'predicate/index.html',
template: 'src/generator.html'
}),
new HtmlWebpackPlugin({
title: 'Advancement Generator Minecraft',
filename: 'advancement/index.html',
template: 'src/generator.html'
}),
new HtmlWebpackPlugin({
title: 'Sandbox Generator Minecraft',
filename: 'sandbox/index.html',
template: 'src/generator.html'
})
]
})