Browse Source

refuse duplicates

master
Marek Piasecki 1 year ago
parent
commit
2408b48a03
  1. 13
      vite.config.js

13
vite.config.js

@ -4,7 +4,7 @@ import { defineConfig } from 'vite';
import { name } from './package.json'
function proRouterViews() {
let views = {}
return {
name: 'pro-router-views',
transformIndexHtml(html) {
@ -17,12 +17,15 @@ function proRouterViews() {
if (/\.imba$/.test(id)) {
let viewRegExp = /tag view-((\w|\S)+)( |\n)/g
let result = null
let views = ""
let views_str = ""
while(result = viewRegExp.exec(src)) {
if(result[1] != 'not_found')
views += "Views.push(\""+ result[1] +"\");"
let view = result[1]
if(view != 'not_found' && !views[view]){
views[view] = true
views_str += "Views.push(\""+ result[1] +"\");"
}
}
return { code: views+src, map: null }
return { code: views_str+src, map: null }
}
}
}

Loading…
Cancel
Save