const esbuild = require('esbuild'); const fs = require('fs'); const path = require('path'); (async () => { const files = [ 'components/SystemSetting/BasicSettings.tsx', 'components/SystemSetting/SerialNumGenerate.jsx', 'components/SystemSetting/DroneManagement.tsx', 'components/SystemSetting/SmartDeviceManagement.tsx', 'components/SystemSetting/AlarmSettingsManagement.tsx', 'components/SystemSetting/LogManagement.tsx', 'components/SystemSetting/OnlineUser.tsx', 'components/SystemSetting/VideoManagement.tsx', 'components/SystemSetting/WorkOrderSettingsManagement.tsx' ]; for (const f of files) { const s = fs.readFileSync('src/' + f, 'utf8'); const ext = path.extname(f); const loader = ext === '.tsx' ? 'tsx' : ext === '.ts' ? 'ts' : ext === '.jsx' ? 'jsx' : 'js'; try { await esbuild.transform(s, { loader, target: 'es2020' }); console.log('ORIG OK ' + f); } catch (e) { console.log('ORIG FAIL ' + f + ' :: ' + String(e.message).split('\n').slice(0, 4).join(' | ')); } } console.log('DONE'); })();