mirror of
https://github.com/chenasraf/nextcloud-app-template.git
synced 2026-05-17 17:28:09 +00:00
build: improve chunking & lint staged
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
'*.{ts,vue}': ['eslint --fix'],
|
'*.{ts,vue}': ['eslint --fix'],
|
||||||
'src/*.{scss,vue,ts,md,json}': ['prettier --write'],
|
'*.{scss,vue,ts,md,json}': ['prettier --write'],
|
||||||
'*.php': [() => 'make php-cs-fixer'],
|
'*.php': [() => 'make php-cs-fixer'],
|
||||||
'*Controller.php': [() => 'make openapi', () => 'git add openapi.json'],
|
'*Controller.php': [() => 'make openapi && git add openapi.json'],
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,42 @@ export default createAppConfig(
|
|||||||
output: {
|
output: {
|
||||||
manualChunks(id) {
|
manualChunks(id) {
|
||||||
if (id.includes('node_modules')) {
|
if (id.includes('node_modules')) {
|
||||||
if (id.includes('@nextcloud/dialogs')) return 'nextcloud-dialogs'
|
const manualChunks = [
|
||||||
if (id.includes('@nextcloud/vue')) return 'nextcloud-vue'
|
'date-fns',
|
||||||
if (id.includes('vue')) return 'vue'
|
'lodash',
|
||||||
if (id.includes('vue-router')) return 'vue-router'
|
'dompurify',
|
||||||
if (id.includes('axios')) return 'axios'
|
'linkifyjs',
|
||||||
|
'floating-vue',
|
||||||
|
'focus-trap',
|
||||||
|
'floating-ui',
|
||||||
|
'vue-router',
|
||||||
|
'vue-material-design-icons',
|
||||||
|
'vue',
|
||||||
|
'axios',
|
||||||
|
]
|
||||||
|
// Get the part after the last 'node_modules/' to handle pnpm structure
|
||||||
|
const parts = id.split('node_modules/')
|
||||||
|
const pkgPath = parts[parts.length - 1]
|
||||||
|
|
||||||
|
// Match @nextcloud/xxx packages
|
||||||
|
const scopedNextcloudMatch = pkgPath.match(/^@nextcloud\/([^/]+)/)
|
||||||
|
if (scopedNextcloudMatch) {
|
||||||
|
return `nextcloud-${scopedNextcloudMatch[1]}`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Match nextcloud-xxx packages (without @ scope)
|
||||||
|
const nextcloudMatch = pkgPath.match(/^nextcloud-([^/]+)/)
|
||||||
|
if (nextcloudMatch) {
|
||||||
|
return `nextcloud-${nextcloudMatch[1]}`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle other common packages
|
||||||
|
for (const chunk of manualChunks) {
|
||||||
|
if (pkgPath.includes(chunk)) {
|
||||||
|
return chunk
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 'vendor' // fallback for other deps
|
return 'vendor' // fallback for other deps
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user