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",
"watch": "cross-env NODE_ENV=development ./node_modules/.bin/webpack --watch --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",
"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"
"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 8081 --hot"
},
"browserslist": [
"> 0.5%",

View File

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