From 0eca757b7325521d00beef2914572ff60bee34b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=89=E9=9E=8B=E6=B2=A1=E5=8F=B7?= <308487730@qq.com> Date: Mon, 5 Oct 2020 21:37:33 +0800 Subject: [PATCH] chore: update --- vite.config.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vite.config.ts b/vite.config.ts index ee93084..16c540f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -49,11 +49,11 @@ const config: UserConfig = { return code } - const electronStoreReg = /(const|let|var)[\n\s]+(\w+)[\n\s]*=[\n\s]*require\(["|'](.+)["|']\)/g - const res = code.match(electronStoreReg) + const cjsRegexp = /(const|let|var)[\n\s]+(\w+)[\n\s]*=[\n\s]*require\(["|'](.+)["|']\)/g + const res = code.match(cjsRegexp) if (res) { // 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 },