1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 17:12:30 +01:00

start adding webpack-serve for hot reloading

This commit is contained in:
Jakob Schrettenbrunner 2018-06-06 22:33:24 +02:00
parent cc58bc9bd5
commit 6ed46c2e75
5 changed files with 12983 additions and 9 deletions

12930
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,7 @@
"css-loader": "^0.28.11",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"glob-all": "^3.1.0",
"html-webpack-plugin": "^3.2.0",
"jquery": "^3.3.1",
"jwt-decode": "^2.2.0",
"lodash": "^4.17.5",
@ -42,9 +43,11 @@
"vueify-insert-css": "^1.0.0",
"webpack": "^4.4.1",
"webpack-assets-manifest": "^3.0.1",
"webpack-cli": "^3.0.1",
"webpack-cli": "^3.0.2",
"webpack-hot-client": "^4.0.2",
"webpack-manifest-plugin": "^2.0.3",
"webpack-serve": "^1.0.2",
"webpack-serve-waitpage": "^1.0.0",
"webpack-shell-plugin": "^0.5.0",
"webpack-stream": "^4.0.3"
},
@ -52,6 +55,7 @@
"build:filemanager": "./node_modules/babel-cli/bin/babel.js public/themes/pterodactyl/js/frontend/files/src --source-maps --out-file public/themes/pterodactyl/js/frontend/files/filemanager.min.js",
"watch": "NODE_ENV=development ./node_modules/.bin/webpack --watch --progress",
"build": "NODE_ENV=development ./node_modules/.bin/webpack --progress",
"build:release": "NODE_ENV=production ./node_modules/.bin/webpack"
"build:release": "NODE_ENV=production ./node_modules/.bin/webpack",
"serve": "NODE_ENV=development webpack-serve --config ./webpack.config.js"
}
}

View File

@ -0,0 +1,18 @@
<html>
<head>
<title>Pterodactyl Dev</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
</head>
<body>
<div id="pterodactyl">
<router-view></router-view>
<div class="w-full m-auto mt-0 container">
<p class="text-right text-grey-dark text-xs">
</p>
</div>
</div>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@ -8,6 +8,8 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ShellPlugin = require('webpack-shell-plugin');
const PurgeCssPlugin = require('purgecss-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const HTMLWebpackPlugin = require('html-webpack-plugin');
const WebpackServeWaitpage = require('webpack-serve-waitpage');
// Custom PurgeCSS extractor for Tailwind that allows special characters in
// class names.
@ -27,7 +29,7 @@ const basePlugins = [
'php artisan ziggy:generate resources/assets/scripts/helpers/ziggy.js',
],
}),
new ExtractTextPlugin('bundle-[chunkhash].css', {
new ExtractTextPlugin('assets/bundle.css', {
allChunks: true,
}),
new AssetsManifestPlugin({
@ -36,6 +38,10 @@ const basePlugins = [
integrity: true,
integrityHashes: ['sha384'],
}),
new HTMLWebpackPlugin({
template: './resources/assets/index.html',
filename: 'index.html',
})
];
const productionPlugins = [
@ -71,9 +77,9 @@ module.exports = {
// Passing an array loads them all but only exports the last.
entry: ['./resources/assets/styles/main.css', './resources/assets/scripts/app.js'],
output: {
path: path.resolve(__dirname, 'public/assets'),
filename: 'bundle-[chunkhash].js',
publicPath: '/assets/',
path: path.resolve(__dirname, 'public'),
filename: 'assets/bundle.js',
publicPath: '/',
crossOriginLoading: 'anonymous',
},
module: {
@ -126,4 +132,20 @@ module.exports = {
symlinks: false,
},
plugins: process.env.NODE_ENV === 'production' ? basePlugins.concat(productionPlugins) : basePlugins,
serve: {
host: "0.0.0.0",
content: "./public/",
dev: {
publicPath: "/"
},
hot: {
host: {
server: "0.0.0.0",
client: "192.168.50.2"
}
},
add (app, middleware, options) {
app.use(WebpackServeWaitpage(options, {theme: 'dark'}));
}
}
};