web/satellite: fix build-watch
Build-watch is broken again since we don't use NODE_ENV variable anymore. Adjusted code to work with 'mode' setting. Change-Id: I08b19ef59b39e6b14ce05d7340f032ee8377c49c
This commit is contained in:
parent
c934974652
commit
fcbb37fb66
@ -46,7 +46,7 @@ export const useAccessGrantsStore = defineStore('accessGrants', () => {
|
|||||||
// TODO(vitalii): create an issue here https://github.com/vitejs/vite
|
// TODO(vitalii): create an issue here https://github.com/vitejs/vite
|
||||||
// about worker chunk being auto removed after rebuild in watch mode if using new URL constructor.
|
// about worker chunk being auto removed after rebuild in watch mode if using new URL constructor.
|
||||||
let worker: Worker;
|
let worker: Worker;
|
||||||
if (process.env.NODE_ENV === 'development') {
|
if (import.meta.env.MODE === 'development') {
|
||||||
worker = new Worker('/static/src/utils/accessGrant.worker.js');
|
worker = new Worker('/static/src/utils/accessGrant.worker.js');
|
||||||
} else {
|
} else {
|
||||||
worker = new Worker(new URL('@/utils/accessGrant.worker.js', import.meta.url));
|
worker = new Worker(new URL('@/utils/accessGrant.worker.js', import.meta.url));
|
||||||
|
@ -22,15 +22,6 @@ const plugins = [
|
|||||||
vitePluginRequire(),
|
vitePluginRequire(),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
|
||||||
plugins.push(viteCompression({
|
|
||||||
algorithm: 'brotliCompress',
|
|
||||||
threshold: 1024,
|
|
||||||
ext: '.br',
|
|
||||||
filter: new RegExp('\\.(' + productionBrotliExtensions.join('|') + ')$'),
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (process.env['STORJ_DEBUG_BUNDLE_SIZE']) {
|
if (process.env['STORJ_DEBUG_BUNDLE_SIZE']) {
|
||||||
plugins.push(visualizer({
|
plugins.push(visualizer({
|
||||||
template: 'treemap', // or sunburst
|
template: 'treemap', // or sunburst
|
||||||
@ -40,7 +31,17 @@ if (process.env['STORJ_DEBUG_BUNDLE_SIZE']) {
|
|||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
export default defineConfig(() => {
|
export default defineConfig(({ mode }) => {
|
||||||
|
// compress chunks only for production mode builds.
|
||||||
|
if (mode === 'production') {
|
||||||
|
plugins.push(viteCompression({
|
||||||
|
algorithm: 'brotliCompress',
|
||||||
|
threshold: 1024,
|
||||||
|
ext: '.br',
|
||||||
|
filter: new RegExp('\\.(' + productionBrotliExtensions.join('|') + ')$'),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: '/static/dist',
|
base: '/static/dist',
|
||||||
plugins,
|
plugins,
|
||||||
|
Loading…
Reference in New Issue
Block a user