mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add custom variable check for webpack dev server
This commit is contained in:
parent
fda52baed5
commit
3b4ff70709
3 changed files with 13 additions and 5 deletions
|
@ -72,9 +72,11 @@ export function getIncludeCorsCredentials() {
|
||||||
|
|
||||||
export function getMultiServer() {
|
export function getMultiServer() {
|
||||||
return getConfig().then(config => {
|
return getConfig().then(config => {
|
||||||
// Enable multi-server support in development environments
|
// Enable multi-server support when served by webpack
|
||||||
return process.env.NODE_ENV === 'development' // eslint-disable-line no-undef
|
if (process.env.WEBPACK_SERVE) { // eslint-disable-line no-undef
|
||||||
|| !!config.multiserver;
|
return true;
|
||||||
|
}
|
||||||
|
return !!config.multiserver;
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log('cannot get web config:', error);
|
console.log('cannot get web config:', error);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -45,8 +45,8 @@ self.addEventListener('notificationclick', function (event) {
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
// Do not precache files in development so live reload works as expected
|
// Do not precache files in development so live reload works as expected
|
||||||
/* eslint-disable-next-line no-undef -- NODE_ENV is replaced by webpack */
|
/* eslint-disable-next-line no-undef -- WEBPACK_SERVE is replaced by webpack */
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.WEBPACK_SERVE) {
|
||||||
// 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);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const common = require('./webpack.common');
|
const common = require('./webpack.common');
|
||||||
const { merge } = require('webpack-merge');
|
const { merge } = require('webpack-merge');
|
||||||
|
const { DefinePlugin } = require('webpack');
|
||||||
|
|
||||||
module.exports = merge(common, {
|
module.exports = merge(common, {
|
||||||
// In order for live reload to work we must use "web" as the target not "browserlist"
|
// In order for live reload to work we must use "web" as the target not "browserlist"
|
||||||
|
@ -23,6 +24,11 @@ module.exports = merge(common, {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
plugins: [
|
||||||
|
new DefinePlugin({
|
||||||
|
'process.env.WEBPACK_SERVE': true
|
||||||
|
})
|
||||||
|
],
|
||||||
devServer: {
|
devServer: {
|
||||||
compress: true,
|
compress: true,
|
||||||
client: {
|
client: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue