Fix bad import, bump esbuild

This commit is contained in:
Steve Ruiz 2021-09-09 17:06:22 +01:00
parent 64e5edbd6f
commit d0e33f22e1
8 changed files with 19 additions and 46 deletions

View file

@ -3,17 +3,24 @@ import fs from 'fs'
import esbuild from 'esbuild' import esbuild from 'esbuild'
import serve, { error, log } from 'create-serve' import serve, { error, log } from 'create-serve'
const isDevServer = process.argv.includes('--dev') const isDevServer = true
if (!fs.existsSync('./dist')) {
fs.mkdirSync('./dist')
}
fs.copyFile('./src/index.html', './dist/index.html', (err) => {
if (err) throw err
})
esbuild esbuild
.build({ .build({
entryPoints: ['src/index.tsx'], entryPoints: ['src/index.tsx'],
bundle: true, bundle: true,
outdir: 'dist', outfile: 'dist/bundle.js',
minify: false, minify: false,
sourcemap: true, sourcemap: true,
incremental: isDevServer, incremental: isDevServer,
platform: 'browser',
target: ['chrome58', 'firefox57', 'safari11', 'edge18'], target: ['chrome58', 'firefox57', 'safari11', 'edge18'],
define: { define: {
'process.env.NODE_ENV': isDevServer ? '"development"' : '"production"', 'process.env.NODE_ENV': isDevServer ? '"development"' : '"production"',
@ -27,11 +34,6 @@ esbuild
}) })
.catch(() => process.exit(1)) .catch(() => process.exit(1))
for (const file of ['index.html']) {
fs.copyFile(`./src/${file}`, `./dist/${file}`, (err) => {
if (err) throw err
})
}
if (isDevServer) { if (isDevServer) {
serve.start({ serve.start({
port: 5000, port: 5000,

View file

@ -11,7 +11,7 @@
"esbuild" "esbuild"
], ],
"scripts": { "scripts": {
"start": "node ./esbuild.config.mjs --dev & tsc --watch" "start": "node ./esbuild.config.mjs --dev tsc --watch"
}, },
"files": [ "files": [
"README.md", "README.md",
@ -32,7 +32,7 @@
"@types/react-router-dom": "^5.1.8", "@types/react-router-dom": "^5.1.8",
"concurrently": "6.0.1", "concurrently": "6.0.1",
"create-serve": "1.0.1", "create-serve": "1.0.1",
"esbuild": "0.11.5", "esbuild": "^0.12.26",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"typescript": "4.2.3" "typescript": "4.2.3"
}, },

View file

@ -1,3 +0,0 @@
/// <reference types="react" />
export default function Embedded(): JSX.Element;
//# sourceMappingURL=embedded.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"embedded.d.ts","sourceRoot":"","sources":["embedded.tsx"],"names":[],"mappings":";AAGA,MAAM,CAAC,OAAO,UAAU,QAAQ,IAAI,GAAG,CAAC,OAAO,CA0B9C"}

View file

@ -1,24 +0,0 @@
import { TLDraw } from '@tldraw/tldraw';
import * as React from 'react';
export default function Embedded() {
return (<div style={{ padding: '2% 10%', width: 'calc(100% - 100px)' }}>
<div style={{
position: 'relative',
width: 'auto',
height: '500px',
overflow: 'hidden',
}}>
<TLDraw id="small1"/>
</div>
<div style={{
position: 'relative',
width: 'auto',
height: '500px',
overflow: 'hidden',
}}>
<TLDraw id="small2"/>
</div>
</div>);
}
//# sourceMappingURL=embedded.jsx.map

View file

@ -1 +0,0 @@
{"version":3,"file":"embedded.jsx","sourceRoot":"","sources":["embedded.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,MAAM,CAAC,OAAO,UAAU,QAAQ;IAC9B,OAAO,CACL,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,CAC7D;MAAA,CAAC,GAAG,CACF,KAAK,CAAC,CAAC;YACL,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,QAAQ;SACnB,CAAC,CAEF;QAAA,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EACrB;MAAA,EAAE,GAAG,CAEL;;MAAA,CAAC,GAAG,CACF,KAAK,CAAC,CAAC;YACL,QAAQ,EAAE,UAAU;YACpB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,QAAQ;SACnB,CAAC,CAEF;QAAA,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,EACrB;MAAA,EAAE,GAAG,CACP;IAAA,EAAE,GAAG,CAAC,CACP,CAAA;AACH,CAAC"}

View file

@ -2,14 +2,14 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<link rel="stylesheet" href="index.css" /> <link rel="stylesheet" href="bundle.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<title>tldraw</title> <title>tldraw</title>
</head> </head>
<body> <body>
<div id="root"></div> <div id="root"></div>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<script type="module" src="./index.js"></script> <script type="module" src="./bundle.js"></script>
<!-- <!--
This HTML file is a template. This HTML file is a template.
If you open it directly in the browser, you will see an empty page. If you open it directly in the browser, you will see an empty page.

View file

@ -6244,16 +6244,16 @@ es6-promisify@^5.0.0:
dependencies: dependencies:
es6-promise "^4.0.3" es6-promise "^4.0.3"
esbuild@0.11.5:
version "0.11.5"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.11.5.tgz#25b18a2ff2fb9580683edce26a48f64c08c2f2df"
integrity sha512-aRs6jAE+bVRp1tyfzUugAw1T/Y0Fwzp4Z2ROikF3h+UifoD5QlEbEYQGc6orNnnSIRhWR5VWBH7LozlAumaLHg==
esbuild@^0.12.24: esbuild@^0.12.24:
version "0.12.25" version "0.12.25"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.25.tgz#c2131cef022cf9fe94aaa5e00110b27fc976221a" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.25.tgz#c2131cef022cf9fe94aaa5e00110b27fc976221a"
integrity sha512-woie0PosbRSoN8gQytrdCzUbS2ByKgO8nD1xCZkEup3D9q92miCze4PqEI9TZDYAuwn6CruEnQpJxgTRWdooAg== integrity sha512-woie0PosbRSoN8gQytrdCzUbS2ByKgO8nD1xCZkEup3D9q92miCze4PqEI9TZDYAuwn6CruEnQpJxgTRWdooAg==
esbuild@^0.12.26:
version "0.12.26"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.12.26.tgz#35f2d58ac3fa4629df24aa4d6fd72feb5522e94b"
integrity sha512-YmTkhPKjvTJ+G5e96NyhGf69bP+hzO0DscqaVJTi5GM34uaD4Ecj7omu5lJO+NrxCUBRhy2chONLK1h/2LwoXA==
escalade@^3.1.1: escalade@^3.1.1:
version "3.1.1" version "3.1.1"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"