1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #3019 from thornbill/enable-multiserver-dev

Enable multiserver in development environments
This commit is contained in:
Bill Thornton 2021-10-07 09:40:31 -04:00 committed by GitHub
commit fad6c83db6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View file

@ -71,6 +71,11 @@ export function getIncludeCorsCredentials() {
} }
export function getMultiServer() { export function getMultiServer() {
// Enable multi-server support when served by webpack
if (__WEBPACK_SERVE__) { // eslint-disable-line no-undef
return Promise.resolve(true);
}
return getConfig().then(config => { return getConfig().then(config => {
return !!config.multiserver; return !!config.multiserver;
}).catch(error => { }).catch(error => {

View file

@ -44,9 +44,8 @@ self.addEventListener('notificationclick', function (event) {
event.waitUntil(executeAction(action, data, serverId)); event.waitUntil(executeAction(action, data, serverId));
}, false); }, false);
// Do not precache files in development so live reload works as expected // Do not precache files when running with webpack dev server so live reload works as expected
/* eslint-disable-next-line no-undef -- NODE_ENV is replaced by webpack */ if (!__WEBPACK_SERVE__) { // eslint-disable-line no-undef
if (process.env.NODE_ENV === 'production') {
// this is needed by the webpack Workbox plugin // this is needed by the webpack Workbox plugin
/* eslint-disable-next-line no-restricted-globals,no-undef */ /* eslint-disable-next-line no-restricted-globals,no-undef */
precacheAndRoute(self.__WB_MANIFEST); precacheAndRoute(self.__WB_MANIFEST);

View file

@ -2,6 +2,7 @@ const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin');
const { DefinePlugin } = require('webpack');
const Assets = [ const Assets = [
'native-promise-only/npo.js', 'native-promise-only/npo.js',
@ -30,6 +31,9 @@ module.exports = {
] ]
}, },
plugins: [ plugins: [
new DefinePlugin({
__WEBPACK_SERVE__: JSON.stringify(!!process.env.WEBPACK_SERVE)
}),
new CleanWebpackPlugin(), new CleanWebpackPlugin(),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
filename: 'index.html', filename: 'index.html',