-
Notifications
You must be signed in to change notification settings - Fork 10
/
webpack.config.js
36 lines (30 loc) · 907 Bytes
/
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
require('dotenv').config()
const path = require('path')
const { merge } = require('webpack-merge')
const commonConfig = require('./webpack/webpack.base.config.js')
const unicodeTilesConfig = require('./webpack/webpack.unicodetiles.config.js')
const pixiConfig = require('./webpack/webpack.pixi.config.js')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = (env, args) => {
const mode = args.mode
const target = process.env.target || 'web'
const gfx = process.env.graphics || 'unicodetiles'
let config
switch(gfx) {
case 'pixi':
config = merge(commonConfig, pixiConfig)
break
default:
config = merge(commonConfig, unicodeTilesConfig)
break
}
config.plugins.push(
new HtmlWebpackPlugin({
template: 'src/index.html',
inject: true,
title: `JSRL | ${gfx} | ${target}`,
graphics: gfx
})
)
return config
}