Skip to content

Commit

Permalink
Maintenance: Fix Vite deprecation warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvuckovic authored and sheremet-va committed Dec 13, 2023
1 parent 934aa90 commit 4839eb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
@@ -1,6 +1,6 @@
// Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/

const { splitVendorChunk } = require('vite')
import { splitVendorChunk } from 'vite'

const matchers = [
{
Expand Down Expand Up @@ -48,7 +48,7 @@ const matchers = [
/**
* @returns {import("vite").Plugin}
*/
const PluginManualChunks = () => {
const ManualChunksPlugin = () => {
const getChunk = splitVendorChunk()

return {
Expand Down Expand Up @@ -93,4 +93,4 @@ const PluginManualChunks = () => {
}
}

module.exports = PluginManualChunks
export default ManualChunksPlugin
8 changes: 4 additions & 4 deletions vite.config.mjs
Expand Up @@ -10,6 +10,7 @@ import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { homedir } from 'os'
import svgIconsPlugin from './app/frontend/build/iconsPlugin.mjs'
import ManualChunksPlugin from './app/frontend/build/manualChunks.mjs'
import tsconfig from './tsconfig.base.json' assert { type: 'json' }

const dir = dirname(fileURLToPath(import.meta.url))
Expand Down Expand Up @@ -38,12 +39,11 @@ export default defineConfig(({ mode, command }) => {
svgIconsPlugin(),
]

// Ruby plugin is not needed inside of the vitest context and has some side effects.
if (!isTesting || isBuild) {
// Ruby plugin is not needed inside of the vitest context and has some side effects.
const { default: RubyPlugin } = require('vite-plugin-ruby')
const ManualChunks = require('./app/frontend/build/manualChunks.js')

plugins.push(RubyPlugin())

plugins.push(
...VitePWA({
disable: isTesting || !!process.env.VITE_TEST_MODE,
Expand All @@ -57,7 +57,7 @@ export default defineConfig(({ mode, command }) => {
strategies: 'injectManifest',
}),
)
plugins.push(ManualChunks())
plugins.push(ManualChunksPlugin())
}

let https = false
Expand Down

0 comments on commit 4839eb0

Please sign in to comment.