2020-04-30 01:48:25 +03:00
|
|
|
const path = require('path');
|
|
|
|
// const HtmlWebpackPlugin = require('html-webpack-plugin');
|
2020-08-03 04:04:01 +03:00
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
2020-10-13 04:49:57 +03:00
|
|
|
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
|
2021-01-06 03:18:35 +03:00
|
|
|
const webpack = require('webpack');
|
2021-02-22 04:55:03 +03:00
|
|
|
const { execSync } = require('child_process');
|
|
|
|
|
|
|
|
const GIT_DESC = execSync('git describe --always', { encoding: 'utf8' }).trim();
|
2020-04-30 01:48:25 +03:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
mode: 'production',
|
|
|
|
entry: {
|
2021-01-28 08:30:48 +03:00
|
|
|
app: './src/index.js',
|
|
|
|
serviceworker: './src/serviceworker.js'
|
2020-04-30 01:48:25 +03:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2020-06-30 05:48:17 +03:00
|
|
|
test: /\.(j|t)sx?$/,
|
2020-04-30 01:48:25 +03:00
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
2020-06-20 07:45:52 +03:00
|
|
|
presets: ['@babel/preset-env', '@babel/typescript', '@babel/preset-react'],
|
2020-04-30 01:48:25 +03:00
|
|
|
plugins: [
|
2020-10-13 04:52:14 +03:00
|
|
|
'lodash',
|
2020-07-15 23:42:56 +03:00
|
|
|
'@babel/transform-runtime',
|
2020-04-30 01:48:25 +03:00
|
|
|
'@babel/plugin-proposal-object-rest-spread',
|
2020-06-19 01:04:30 +03:00
|
|
|
'@babel/plugin-proposal-optional-chaining',
|
|
|
|
'@babel/plugin-proposal-class-properties'
|
2020-04-30 01:48:25 +03:00
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2020-11-10 05:47:12 +03:00
|
|
|
exclude: /node_modules\/(?!(@tlon\/indigo-dark|@tlon\/indigo-light)\/).*/
|
2020-04-30 01:48:25 +03:00
|
|
|
},
|
|
|
|
{
|
2020-06-19 01:04:30 +03:00
|
|
|
test: /\.css$/i,
|
2020-04-30 01:48:25 +03:00
|
|
|
use: [
|
|
|
|
// Creates `style` nodes from JS strings
|
|
|
|
'style-loader',
|
|
|
|
// Translates CSS into CommonJS
|
|
|
|
'css-loader',
|
|
|
|
// Compiles Sass to CSS
|
|
|
|
'sass-loader'
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
resolve: {
|
2020-06-30 05:48:17 +03:00
|
|
|
extensions: ['.js', '.ts', '.tsx']
|
2020-04-30 01:48:25 +03:00
|
|
|
},
|
2020-10-14 06:26:40 +03:00
|
|
|
devtool: 'source-map',
|
2020-04-30 01:48:25 +03:00
|
|
|
// devServer: {
|
|
|
|
// contentBase: path.join(__dirname, './'),
|
|
|
|
// hot: true,
|
|
|
|
// port: 9000,
|
|
|
|
// historyApiFallback: true
|
|
|
|
// },
|
|
|
|
plugins: [
|
2020-10-13 04:49:57 +03:00
|
|
|
new MomentLocalesPlugin(),
|
2020-08-04 03:41:55 +03:00
|
|
|
new CleanWebpackPlugin(),
|
2021-01-06 03:18:35 +03:00
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env.LANDSCAPE_STREAM': JSON.stringify(process.env.LANDSCAPE_STREAM),
|
2021-02-22 04:55:03 +03:00
|
|
|
'process.env.LANDSCAPE_SHORTHASH': JSON.stringify(GIT_DESC),
|
2021-02-08 04:02:52 +03:00
|
|
|
'process.env.TUTORIAL_HOST': JSON.stringify('~hastuc-dibtux'),
|
|
|
|
'process.env.TUTORIAL_GROUP': JSON.stringify('beginner-island'),
|
|
|
|
'process.env.TUTORIAL_CHAT': JSON.stringify('chat-8401'),
|
|
|
|
'process.env.TUTORIAL_BOOK': JSON.stringify('notebook-9148'),
|
|
|
|
'process.env.TUTORIAL_LINKS': JSON.stringify('links-4353'),
|
2021-02-22 04:55:03 +03:00
|
|
|
})
|
2020-04-30 01:48:25 +03:00
|
|
|
// new HtmlWebpackPlugin({
|
|
|
|
// title: 'Hot Module Replacement',
|
|
|
|
// template: './public/index.html',
|
|
|
|
// }),
|
|
|
|
],
|
|
|
|
output: {
|
2021-01-28 08:30:48 +03:00
|
|
|
filename: (pathData) => {
|
|
|
|
return pathData.chunk.name === 'app' ? 'index.[contenthash].js' : '[name].js';
|
|
|
|
},
|
2020-08-04 03:41:55 +03:00
|
|
|
path: path.resolve(__dirname, '../../arvo/app/landscape/js/bundle'),
|
2021-01-06 03:24:51 +03:00
|
|
|
publicPath: '/'
|
2020-04-30 01:48:25 +03:00
|
|
|
},
|
|
|
|
optimization: {
|
|
|
|
minimize: true,
|
|
|
|
usedExports: true
|
|
|
|
}
|
|
|
|
};
|