Closed serg06 closed 2 years ago
Hello, thank you for the issue.
Change esbuild.config.js
like this
const {build} = require("esbuild")
const esBuildDevServer = require("esbuild-dev-server")
esBuildDevServer.start(
build({
entryPoints: ["src/index.tsx"],
outdir: "dist/js",
incremental: true,
bundle: true,
minify: true,
sourcemap: true,
// and more options ...
}),
{
port: "8080", // optional, default: 8080
watchDir: "src", // optional, default: "src"
index: "dist/index.html", // optional
staticDir: "dist", // optional
onBeforeRebuild: {}, // optional
onAfterRebuild: {}, // optional
}
)
and index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div id="root"></div>
<script src="js/index.js"></script>
</body>
</html>
everything should be working.
@Falldot It works, thank you!
I did the following:
src/index.tsx
(see code below)entryPoints: ["src/index.tsx"]
.node config/esbuild.config.js
Expected result:
Actual result:
Uncaught SyntaxError: Unexpected token '<'
index.js
, but the response body was just the text inside theindex.html
src/index.tsx: