Skip to content

Commit

Permalink
fix(app-vite/app-webpack): quasar.config > framework > lang/iconSet p…
Browse files Browse the repository at this point in the history
…arsing
  • Loading branch information
rstoenescu committed May 7, 2024
1 parent d8c53b5 commit 8ca0684
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
19 changes: 13 additions & 6 deletions app-vite/lib/quasar-config-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ function uniquePathFilter (value, index, self) {
return self.map(obj => obj.path).indexOf(value.path) === index
}

const extRE = /\.[m|c]?[j|t]s$/
function formatQuasarAssetPath (asset, type) {
return asset.indexOf('/') !== -1
? (
extRE.test(asset) === true
? asset
: `${ asset }.js`
)
: `quasar/${ type }/${ asset }.js`
}

let cachedExternalHost, addressRunning = false

async function onAddress ({ host, port }, mode) {
Expand Down Expand Up @@ -670,15 +681,11 @@ export class QuasarConfigFile {
const { lang, iconSet } = cfg.framework

if (lang !== void 0) {
cfg.framework.lang = lang.indexOf('/') === true
? lang
: `quasar/lang/${ lang }.js`
cfg.framework.lang = formatQuasarAssetPath(lang, 'lang')
}

if (iconSet !== void 0) {
cfg.framework.iconSet = iconSet.indexOf('/') === true
? iconSet
: `quasar/icon-set/${ iconSet }.js`
cfg.framework.iconSet = formatQuasarAssetPath(iconSet, 'icon-set')
}

Object.assign(cfg.metaConf, {
Expand Down
19 changes: 13 additions & 6 deletions app-webpack/lib/quasar-config-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,17 @@ function uniqueRegexFilter (value, index, self) {
return self.map(regex => regex.toString()).indexOf(value.toString()) === index
}

const extRE = /\.[m|c]?[j|t]s$/
function formatQuasarAssetPath (asset, type) {
return asset.indexOf('/') !== -1
? (
extRE.test(asset) === true
? asset
: `${ asset }.js`
)
: `quasar/${ type }/${ asset }.js`
}

let cachedExternalHost, addressRunning = false

async function onAddress ({ host, port }, mode) {
Expand Down Expand Up @@ -698,15 +709,11 @@ module.exports.QuasarConfigFile = class QuasarConfigFile {
const { lang, iconSet } = cfg.framework

if (lang !== void 0) {
cfg.framework.lang = lang.indexOf('/') === true
? lang
: `quasar/lang/${ lang }.js`
cfg.framework.lang = formatQuasarAssetPath(lang, 'lang')
}

if (iconSet !== void 0) {
cfg.framework.iconSet = iconSet.indexOf('/') === true
? iconSet
: `quasar/icon-set/${ iconSet }.js`
cfg.framework.iconSet = formatQuasarAssetPath(iconSet, 'icon-set')
}

Object.assign(cfg.metaConf, {
Expand Down

0 comments on commit 8ca0684

Please sign in to comment.