无法加载模块脚本:预期一个JavaScript模块脚本,但服务器以MIME类型的响应“”
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.
我无法加载VUEJS组件,
我使用Ruby-on-on-lails 7作为后端部分,而Vuejs 3用于前端。
我将VUE JS依赖项添加到ImportMap配置中。 路径:config/importmap.rb:
pin "application", preload: true
pin "vue", to: "https://ga.jspm.io/npm:[email protected]/dist/vue.esm-browser.js"
路径:app/javascript/application.js
import * as View from "view"
import PollShow from "./PollShow.vue"
const app = Vue.createApp()
app.component('PollShow', PollShow)
app.mount('#poll_show')
,然后添加vue js import vuejs和component pollshow.vue.vue.js中 但是,VUE JS导入效果很好,但是组件导入不起作用。 您是否知道为什么这不起作用?
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.
Failed to load Vuejs components
I use Ruby-on-Rails 7 for the backend part, and VueJS 3 for frontend.
I added vue js dependencies to importmap configuration.
Path: config/importmap.rb:
pin "application", preload: true
pin "vue", to: "https://ga.jspm.io/npm:[email protected]/dist/vue.esm-browser.js"
path : app/javascript/application.js
import * as View from "view"
import PollShow from "./PollShow.vue"
const app = Vue.createApp()
app.component('PollShow', PollShow)
app.mount('#poll_show')
And then added vue js import vuejs and component PollShow.vue in application.js
However vue js import works well but component import is not working.
Do you have any idea why this is not working ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论