更新时间:2021-10-14 21:31:00
现在/app.bundle.js
返回
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /app.bundle.js</pre>
</body>
</html>
由于设置错误.
app.use(express.static(__ dirname +'dist'));
app.use(express.static(__ dirname +'/dist'));
__ dirname
不包含斜杠.
/.../myApp/dist/app.bundle.js
index.html
作为JavaScript文件来源 app.bundle.js
,MIME预计为 text/javascript
等. app.use(express.static(__ dirname +'dist'))
app.use(express.static('/.../myAppdist/app.bundle.js'))
不存在. text/html
/.../myApp/dist/app.bundle.js
index.html
sources app.bundle.js
as javascript file, which MIME is expected to be text/javascript
, etc.app.use(express.static(__dirname + 'dist'))
app.use(express.static('/.../myAppdist/app.bundle.js'))
does not exist.text/html