gpt4 book ai didi

vaadin - 将 Vaadin 14.0.10 应用程序更新到 14.5.4 会导致从/VAADIN/加载的资源出现 MIME 类型错误

转载 作者:行者123 更新时间:2023-12-05 02:00:19 24 4
gpt4 key购买 nike

我有一个带有 Spring Boot 和 Spring Security 配置的 Vaadin 14.0.10 应用程序。我正在尝试将其更新到 14.5.4,但更新后,当我尝试加载应用程序时出现空白页面。服务器日志上没有错误,但是在浏览器控制台上,却显示了两个错误:

Refused to execute script from 'http://localhost:8080/login' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

login:1 Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

查看“网络”选项卡,似乎 webcomponents-loader.jsvaadin-bundle-*.cache.js 都获得状态 302“脚本/重定向” .这两个文件都在 /VAADIN/build 下提供。

起初我认为这可能是 Spring Security 配置问题,但在我的 WebSecurityConfigurerAdapter 实现中,我有:

    @Override
public void configure(WebSecurity web) throws Exception {

web.ignoring().antMatchers(
// Vaadin Flow static resources
"/VAADIN/**",

// the standard favicon URI
"/favicon.ico",

// the robots exclusion standard
"/robots.txt",
// and so on

...和 ​​/VAADIN/** 匹配器应该负责提供对有问题的文件的访问权限。

我试过运行 mvn clean,我已经删除并重新填充 node_modules 但无济于事。

最佳答案

问题是 webpack.generated.js,它被错误地存储在项目的 Git 存储库中。删除文件并重建项目解决了这个问题。尽管从某种意义上说这是一个“用户错误”,但在版本升级的情况下,该文件应该会被自动覆盖,因为 webpack 输出路径已在 14.0 和 14.5 之间更改:https://github.com/vaadin/flow/issues/10932

关于vaadin - 将 Vaadin 14.0.10 应用程序更新到 14.5.4 会导致从/VAADIN/加载的资源出现 MIME 类型错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67429784/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com