Files
misode.github.io/webpack.config.js
2020-07-09 22:16:54 +02:00

81 lines
2.2 KiB
JavaScript

const CopyWebpackPlugin = require('copy-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MergeJsonWebpackPlugin = require("merge-jsons-webpack-plugin");
module.exports = (env, argv) => ({
entry: './src/app/app.ts',
output: {
path: __dirname + '/dist',
publicPath: argv.mode === 'production' ? '/dev/' : '/',
filename: 'js/bundle.js'
},
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [
{ test: /\.ts$/, loader: 'ts-loader' }
]
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{
from: 'src/styles',
to: 'styles'
}
]
}),
new MergeJsonWebpackPlugin({
output: {
groupBy: [ 'de', 'en', 'fr', 'it', 'ja', 'pt', 'ru', 'zh-cn' ].map(code => (
{
pattern: `{./src/locales/${code}.json,./node_modules/@mcschema/core/locales/${code}.json}`,
fileName: `./locales/${code}.json`
}
))
}
}),
new HtmlWebpackPlugin({
title: 'Data Pack Generators Minecraft',
filename: 'index.html',
template: 'src/index.html'
}),
new HtmlWebpackPlugin({
title: 'Loot Table Generator Minecraft',
filename: 'loot-table/index.html',
template: 'src/index.html'
}),
new HtmlWebpackPlugin({
title: 'Predicate Generator Minecraft',
filename: 'predicate/index.html',
template: 'src/index.html'
}),
new HtmlWebpackPlugin({
title: 'Advancement Generator Minecraft',
filename: 'advancement/index.html',
template: 'src/index.html'
}),
new HtmlWebpackPlugin({
title: 'Dimension Generator Minecraft',
filename: 'dimension/index.html',
template: 'src/index.html'
}),
new HtmlWebpackPlugin({
title: 'Dimension Type Generator Minecraft',
filename: 'dimension-type/index.html',
template: 'src/index.html'
}),
new HtmlWebpackPlugin({
title: 'Biome Generator Minecraft',
filename: 'worldgen/biome/index.html',
template: 'src/index.html'
}),
new HtmlWebpackPlugin({
title: 'Feature Generator Minecraft',
filename: 'worldgen/feature/index.html',
template: 'src/index.html'
})
]
})