2020-04-03 14:56:21 +02:00
|
|
|
const path = require('path');
|
|
|
|
const webpack = require('webpack');
|
2020-06-01 11:53:12 +02:00
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
2021-03-18 12:37:05 +01:00
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
2020-04-03 14:56:21 +02:00
|
|
|
|
|
|
|
module.exports = {
|
2021-03-04 19:00:00 +01:00
|
|
|
entry: {
|
|
|
|
'main': './src/index.ts',
|
|
|
|
'iframe_api': './src/iframe_api.ts'
|
|
|
|
},
|
2020-04-03 14:56:21 +02:00
|
|
|
devtool: 'inline-source-map',
|
|
|
|
devServer: {
|
|
|
|
contentBase: './dist',
|
2020-04-03 18:31:11 +02:00
|
|
|
host: '0.0.0.0',
|
2021-03-31 16:20:21 +02:00
|
|
|
sockPort: 80,
|
2020-04-03 18:31:11 +02:00
|
|
|
disableHostCheck: true,
|
2020-05-12 00:07:50 +02:00
|
|
|
historyApiFallback: {
|
|
|
|
rewrites: [
|
|
|
|
{ from: /^_\/.*$/, to: '/index.html' }
|
|
|
|
],
|
|
|
|
disableDotRule: true
|
|
|
|
},
|
2020-04-03 14:56:21 +02:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
use: 'ts-loader',
|
|
|
|
exclude: /node_modules/,
|
|
|
|
},
|
2021-03-18 12:37:05 +01:00
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
|
|
|
use: [MiniCssExtractPlugin.loader, 'css-loader?url=false', 'sass-loader'],
|
|
|
|
},
|
2020-04-03 14:56:21 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: [ '.tsx', '.ts', '.js' ],
|
|
|
|
},
|
|
|
|
output: {
|
2021-03-04 19:00:00 +01:00
|
|
|
filename: (pathData) => {
|
|
|
|
// Add a content hash only for the main bundle.
|
|
|
|
// We want the iframe_api.js file to keep its name as it will be referenced from outside iframes.
|
|
|
|
return pathData.chunk.name === 'main' ? 'js/[name].[contenthash].js': '[name].js';
|
|
|
|
},
|
2020-04-03 14:56:21 +02:00
|
|
|
path: path.resolve(__dirname, 'dist'),
|
2020-05-12 00:07:50 +02:00
|
|
|
publicPath: '/'
|
2020-04-03 14:56:21 +02:00
|
|
|
},
|
2021-05-12 10:35:14 +02:00
|
|
|
/*externals:[
|
2020-07-23 18:09:24 +02:00
|
|
|
require('webpack-require-http')
|
2021-05-12 10:35:14 +02:00
|
|
|
],*/
|
2020-04-03 14:56:21 +02:00
|
|
|
plugins: [
|
2021-03-18 15:05:15 +01:00
|
|
|
new MiniCssExtractPlugin({filename: 'style.[contenthash].css'}),
|
2020-06-01 11:53:12 +02:00
|
|
|
new HtmlWebpackPlugin(
|
|
|
|
{
|
2021-03-05 10:00:11 +01:00
|
|
|
template: './dist/index.tmpl.html.tmp',
|
2021-02-02 11:19:24 +01:00
|
|
|
minify: {
|
|
|
|
collapseWhitespace: true,
|
|
|
|
keepClosingSlash: true,
|
|
|
|
removeComments: false,
|
|
|
|
removeRedundantAttributes: true,
|
|
|
|
removeScriptTypeAttributes: true,
|
|
|
|
removeStyleLinkTypeAttributes: true,
|
|
|
|
useShortDoctype: true
|
2021-03-04 19:00:00 +01:00
|
|
|
},
|
|
|
|
chunks: ['main']
|
2020-06-01 11:53:12 +02:00
|
|
|
}
|
|
|
|
),
|
2020-04-03 14:56:21 +02:00
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
Phaser: 'phaser'
|
2020-04-03 18:31:11 +02:00
|
|
|
}),
|
2021-03-31 16:20:11 +02:00
|
|
|
new webpack.EnvironmentPlugin({
|
|
|
|
'API_URL': null,
|
|
|
|
'PUSHER_URL': undefined,
|
|
|
|
'UPLOADER_URL': null,
|
|
|
|
'ADMIN_URL': null,
|
|
|
|
'DEBUG_MODE': null,
|
|
|
|
'STUN_SERVER': null,
|
|
|
|
'TURN_SERVER': null,
|
|
|
|
'TURN_USER': null,
|
|
|
|
'TURN_PASSWORD': null,
|
|
|
|
'JITSI_URL': null,
|
|
|
|
'JITSI_PRIVATE_MODE': null,
|
2021-05-12 10:35:14 +02:00
|
|
|
'START_ROOM_URL': null,
|
|
|
|
'MAX_USERNAME_LENGTH': 8,
|
|
|
|
'MAX_PER_GROUP': 4
|
2021-03-31 16:20:11 +02:00
|
|
|
})
|
2020-07-28 11:06:08 +02:00
|
|
|
],
|
|
|
|
|
2020-04-03 14:56:21 +02:00
|
|
|
};
|