Fixed line-endings

This commit is contained in:
2021-07-24 20:23:18 +10:00
parent 7a48780f50
commit f24c7990f6
+116 -116
View File
@@ -1,116 +1,116 @@
//plugins //plugins
const { DefinePlugin } = require('webpack'); const { DefinePlugin } = require('webpack');
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
//libraries //libraries
const path = require('path'); const path = require('path');
//the exported config function //the exported config function
module.exports = ({ production, analyzer }) => { module.exports = ({ production, analyzer }) => {
return { return {
mode: production ? "production" : "development", mode: production ? "production" : "development",
entry: path.resolve(__dirname, 'client', 'client.jsx'), entry: path.resolve(__dirname, 'client', 'client.jsx'),
output: { output: {
path: path.resolve(__dirname, 'public'), path: path.resolve(__dirname, 'public'),
filename: '[name].[chunkhash].js', filename: '[name].[chunkhash].js',
sourceMapFilename: '[name].[chunkhash].js.map' sourceMapFilename: '[name].[chunkhash].js.map'
}, },
devtool: production ? 'source-map' : 'eval-source-map', devtool: production ? 'source-map' : 'eval-source-map',
resolve: { resolve: {
extensions: ['.js', '.jsx'] extensions: ['.js', '.jsx']
}, },
module: { module: {
rules: [ rules: [
{ {
test: /\.(js|jsx)$/, test: /\.(js|jsx)$/,
exclude: /(node_modules)/, exclude: /(node_modules)/,
use: [ use: [
{ {
loader: 'babel-loader', loader: 'babel-loader',
options: { options: {
presets: ['@babel/preset-env', '@babel/preset-react'], presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: ['@babel/plugin-syntax-dynamic-import'] plugins: ['@babel/plugin-syntax-dynamic-import']
} }
} }
] ]
}, },
{ {
test: /\.(css)$/, test: /\.(css)$/,
use: ['style-loader', 'css-loader'] use: ['style-loader', 'css-loader']
}, },
{ {
test: /\.(md)$/, test: /\.(md)$/,
use: [ use: [
{ {
loader: 'raw-loader' loader: 'raw-loader'
}, },
], ],
}, },
] ]
}, },
plugins: [ plugins: [
new DefinePlugin({ new DefinePlugin({
'process.env': { 'process.env': {
'PRODUCTION': production, 'PRODUCTION': production,
'NEWS_URI': production ? `"${process.env.NEWS_URI}"` : '"https://dev-news.krgamestudios.com"', 'NEWS_URI': production ? `"${process.env.NEWS_URI}"` : '"https://dev-news.krgamestudios.com"',
'AUTH_URI': production ? `"${process.env.AUTH_URI}"` : '"https://dev-auth.krgamestudios.com"', 'AUTH_URI': production ? `"${process.env.AUTH_URI}"` : '"https://dev-auth.krgamestudios.com"',
'CHAT_URI': production ? `"${process.env.CHAT_URI}"` : '"https://dev-chat.krgamestudios.com"', 'CHAT_URI': production ? `"${process.env.CHAT_URI}"` : '"https://dev-chat.krgamestudios.com"',
} }
}), }),
new CleanWebpackPlugin({ new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['*', '!content*'] cleanOnceBeforeBuildPatterns: ['*', '!content*']
}), }),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: './client/template.html', template: './client/template.html',
minify: { minify: {
collapseWhitespace: production, collapseWhitespace: production,
removeComments: production, removeComments: production,
removeAttributeQuotes: production removeAttributeQuotes: production
} }
}), }),
new BundleAnalyzerPlugin({ new BundleAnalyzerPlugin({
analyzerMode: analyzer ? 'server' : 'disabled' analyzerMode: analyzer ? 'server' : 'disabled'
}) })
], ],
devServer: { devServer: {
contentBase: path.resolve(__dirname, 'public'), contentBase: path.resolve(__dirname, 'public'),
compress: true, compress: true,
port: 3001, port: 3001,
proxy: { proxy: {
'/api/': 'http://localhost:3000/' '/api/': 'http://localhost:3000/'
}, },
overlay: { overlay: {
errors: true errors: true
}, },
stats: { stats: {
colors: true, colors: true,
hash: false, hash: false,
version: false, version: false,
timings: false, timings: false,
assets: false, assets: false,
chunks: false, chunks: false,
modules: false, modules: false,
reasons: false, reasons: false,
children: false, children: false,
source: false, source: false,
errors: true, errors: true,
errorDetails: false, errorDetails: false,
warnings: true, warnings: true,
publicPath: false publicPath: false
}, },
host: '0.0.0.0', host: '0.0.0.0',
disableHostCheck: true, disableHostCheck: true,
clientLogLevel: 'silent', clientLogLevel: 'silent',
historyApiFallback: true, historyApiFallback: true,
hot: true, hot: true,
injectHot: true injectHot: true
}, },
watchOptions: { watchOptions: {
ignored: /(node_modules)/ ignored: /(node_modules)/
} }
} }
}; };