Addapt dev settings

This commit is contained in:
Angelillo15 2023-07-08 22:48:06 +02:00
parent a99941eb2b
commit 80f51e0af2
2 changed files with 26 additions and 17 deletions

View File

@ -135,8 +135,8 @@
"lint": "eslint ./resources/scripts/**/*.{ts,tsx} --ext .ts,.tsx", "lint": "eslint ./resources/scripts/**/*.{ts,tsx} --ext .ts,.tsx",
"watch": "cross-env NODE_ENV=development ./node_modules/.bin/webpack --watch --progress", "watch": "cross-env NODE_ENV=development ./node_modules/.bin/webpack --watch --progress",
"build": "cross-env NODE_ENV=development ./node_modules/.bin/webpack --progress", "build": "cross-env NODE_ENV=development ./node_modules/.bin/webpack --progress",
"build:production": "yarn run clean && cross-env NODE_ENV=production ./node_modules/.bin/webpack --mode production", "build:production": "yarn run clean && cross-env NODE_ENV=production ./node_modules/.bin/webpack --mode production --progress",
"serve": "yarn run clean && cross-env WEBPACK_PUBLIC_PATH=/webpack@hmr/ NODE_ENV=development webpack-dev-server --host 0.0.0.0 --port 8080 --public https://pterodactyl.test --hot" "serve": "yarn run clean && cross-env WEBPACK_PUBLIC_PATH=/webpack@hmr/ NODE_ENV=development webpack-dev-server --host 0.0.0.0 --port 8081 --hot"
}, },
"browserslist": [ "browserslist": [
"> 0.5%", "> 0.5%",

View File

@ -11,7 +11,7 @@ module.exports = {
cache: true, cache: true,
target: 'web', target: 'web',
mode: process.env.NODE_ENV, mode: process.env.NODE_ENV,
devtool: isProduction ? false : (process.env.DEVTOOL || 'eval-source-map'), devtool: isProduction ? false : process.env.DEVTOOL || 'eval-source-map',
performance: { performance: {
hints: false, hints: false,
}, },
@ -20,7 +20,7 @@ module.exports = {
path: path.join(__dirname, '/public/assets'), path: path.join(__dirname, '/public/assets'),
filename: isProduction ? 'bundle.[chunkhash:8].js' : 'bundle.[hash:8].js', filename: isProduction ? 'bundle.[chunkhash:8].js' : 'bundle.[hash:8].js',
chunkFilename: isProduction ? '[name].[chunkhash:8].js' : '[name].[hash:8].js', chunkFilename: isProduction ? '[name].[chunkhash:8].js' : '[name].[hash:8].js',
publicPath: (process.env.WEBPACK_PUBLIC_PATH || '/assets/'), publicPath: process.env.WEBPACK_PUBLIC_PATH || '/assets/',
crossOriginLoading: 'anonymous', crossOriginLoading: 'anonymous',
}, },
module: { module: {
@ -72,7 +72,7 @@ module.exports = {
test: /\.js$/, test: /\.js$/,
enforce: 'pre', enforce: 'pre',
loader: 'source-map-loader', loader: 'source-map-loader',
} },
], ],
}, },
stats: { stats: {
@ -109,15 +109,19 @@ module.exports = {
syntactic: true, syntactic: true,
}, },
}, },
eslint: isProduction ? undefined : { eslint: isProduction
files: `${path.join(__dirname, '/resources/scripts')}/**/*.{ts,tsx}`, ? undefined
} : {
files: `${path.join(__dirname, '/resources/scripts')}/**/*.{ts,tsx}`,
},
}), }),
process.env.ANALYZE_BUNDLE ? new BundleAnalyzerPlugin({ process.env.ANALYZE_BUNDLE
analyzerHost: '0.0.0.0', ? new BundleAnalyzerPlugin({
analyzerPort: 8081, analyzerHost: '0.0.0.0',
}) : null analyzerPort: 8081,
].filter(p => p), })
: null,
].filter((p) => p),
optimization: { optimization: {
usedExports: true, usedExports: true,
sideEffects: false, sideEffects: false,
@ -143,14 +147,19 @@ module.exports = {
ignored: /node_modules/, ignored: /node_modules/,
}, },
devServer: { devServer: {
compress: true, compress: true,
contentBase: path.join(__dirname, '/public'), contentBase: path.join(__dirname, '/public'),
publicPath: process.env.WEBPACK_PUBLIC_PATH || '/assets/', publicPath: process.env.WEBPACK_PUBLIC_PATH || '/assets/',
allowedHosts: [ writeToDisk: true,
'.pterodactyl.test', allowedHosts: ['localhost'],
],
headers: { headers: {
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': '*',
}, },
proxy: {
'*': {
target: 'http://localhost:8000/',
changeOrigin: true,
},
},
}, },
}; };