我正在通过vue应用程序(使用create-vue-app创建)提供dist文件夹。但是,当我不指向某些特定路由时,它很好用,只需使用根路由而无需任何操作。但是,如果我指定了一条子路由,例如'/static'
,则它不支持vue应用程序dist index.html ...我在浏览器中收到消息:
Refused to apply style from 'http://localhost:3000/css/app.fc1b515e.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
4localhost/:1 GET http://localhost:3000/js/app.6869d12b.js net::ERR_ABORTED 404 (Not Found)
但是,如果我在浏览器中的路径中输入favicon.ico,它将找到favicon.ico。
有时,我还会收到错误消息,告诉我未启用javascript(这是错误的...)>
这是我设置路线的方式:
app.use('/static',express.static(path.join(__dirname, '\\client\\dist')));
我正在通过vue应用程序(使用create-vue-app创建)提供dist文件夹。但是,当我不指向某些特定路由时,它很好用,只需使用根路由而无需任何操作。但是,如果我...
您的Vue应用正在引用相对于/
的资产,如下所示:
/css/app.fc1b515e.css
/js/app.6869d12b.js