590562b5ba
* Removes references to webpack scripts from .vscode settings * clean up scripts, remove references to webpack * works! * Delete getHtmlForWebview.ts * Update scripts * Update package.json * Remove more config * Enable debugger into ts files * Fixes fails on New TLDraw Document Co-authored-by: Proful <proful.sadangi@gmail.com>
46 lines
861 B
JavaScript
46 lines
861 B
JavaScript
/* eslint-disable no-undef */
|
|
import fs from 'fs'
|
|
import esbuildServe from 'esbuild-serve'
|
|
import dotenv from 'dotenv'
|
|
|
|
dotenv.config()
|
|
|
|
async function main() {
|
|
if (fs.existsSync('./dist')) {
|
|
fs.rmSync('./dist', { recursive: true }, (e) => {
|
|
if (e) {
|
|
throw e
|
|
}
|
|
})
|
|
}
|
|
|
|
try {
|
|
await esbuildServe(
|
|
{
|
|
entryPoints: ['src/index.tsx'],
|
|
outfile: 'dist/index.js',
|
|
minify: false,
|
|
bundle: true,
|
|
incremental: true,
|
|
target: 'es6',
|
|
define: {
|
|
'process.env.NODE_ENV': '"production"',
|
|
},
|
|
watch: {
|
|
onRebuild(err) {
|
|
err ? error('❌ Failed') : log('✅ Updated')
|
|
},
|
|
},
|
|
},
|
|
{
|
|
port: 5420,
|
|
root: './dist',
|
|
live: true,
|
|
}
|
|
)
|
|
} catch (err) {
|
|
process.exit(1)
|
|
}
|
|
}
|
|
|
|
main()
|