tldraw/vscode/editor/scripts/build.mjs
Steve Ruiz 590562b5ba
[fix] vscode bugs (#271)
* 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>
2021-11-13 08:49:34 +00:00

40 lines
883 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* eslint-disable */
import fs from 'fs'
import esbuild from 'esbuild'
import { createRequire } from 'module'
const pkg = createRequire(import.meta.url)('../package.json')
async function main() {
if (fs.existsSync('./dist')) {
fs.rmSync('./dist', { recursive: true }, (e) => {
if (e) {
throw e
}
})
}
try {
esbuild.buildSync({
entryPoints: ['./src/index.tsx'],
outfile: 'dist/index.js',
minify: true,
bundle: true,
format: 'esm',
target: 'es6',
jsxFactory: 'React.createElement',
jsxFragment: 'React.Fragment',
tsconfig: './tsconfig.json',
define: {
'process.env.NODE_ENV': '"production"',
},
})
console.log(`${pkg.name}: Build completed.`)
} catch (e) {
console.log(`× ${pkg.name}: Build failed due to an error.`)
console.log(e)
}
}
main()