Angular 13& HTTPD24-无法加载模块脚本:预期JavaScript模块脚本,但服务器以“摩尔类型”响应“”

发布于 2025-01-30 07:59:02 字数 311 浏览 2 评论 0原文

我已经将应用程序从Angular 10迁移到Angular 13,然后开始在浏览器控制台中遇到此错误。我尝试了Stackoverflow中提到的大多数解决方案。但是没有运气。由于代码与Angular 10正确地工作,但是迁移到13后,我会在浏览器中遇到MIME错误。请建议。提前致谢!

enter image description here

I have migrated my application from angular 10 to angular 13 and I started getting this error in browser console. I have tried most of the solution mentioned in the stackoverflow. But there is no luck. Since code was working correctly with angular 10 but after migrating to 13 I am getting MIME error in browser. Please suggest. Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半世晨晓 2025-02-06 07:59:02

如果您使用Express运行生产应用程序,请确保指向正确的构建目录

app.use(express.static(path.join(__dirname, "../dist/project_folder")));

app.get("/*", (req, res) => {
    res.sendFile(path.join(__dirname, "../dist/project_folder/index.html"));
});

Make sure you are pointing to the correct build directory if you are using express to run your production app

app.use(express.static(path.join(__dirname, "../dist/project_folder")));

app.get("/*", (req, res) => {
    res.sendFile(path.join(__dirname, "../dist/project_folder/index.html"));
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文