chore: update

This commit is contained in:
草鞋没号 2020-10-05 21:37:33 +08:00
parent 0fa706437d
commit 0eca757b73

View File

@ -49,11 +49,11 @@ const config: UserConfig = {
return code return code
} }
const electronStoreReg = /(const|let|var)[\n\s]+(\w+)[\n\s]*=[\n\s]*require\(["|'](.+)["|']\)/g const cjsRegexp = /(const|let|var)[\n\s]+(\w+)[\n\s]*=[\n\s]*require\(["|'](.+)["|']\)/g
const res = code.match(electronStoreReg) const res = code.match(cjsRegexp)
if (res) { if (res) {
// const Store = require('electron-store') -> import Store from 'electron-store' // const Store = require('electron-store') -> import Store from 'electron-store'
code = code.replace(electronStoreReg, `import $2 from '$3'`) code = code.replace(cjsRegexp, `import $2 from '$3'`)
} }
return code return code
}, },