diff --git a/package.json b/package.json index e716485cb..66a17439d 100644 --- a/package.json +++ b/package.json @@ -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%", diff --git a/webpack.config.js b/webpack.config.js index aa240fbd6..471f1fcfc 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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, + }, + }, }, };