2017-07-03 54 views
-1

使用Express服務於Vue.js webpack應用程序,部署後我收到以下錯誤: enter image description here 我的代碼是否是服務應用程序的問題?使用錯誤的MIME類型快速發送資產

app.use(helmet()) 

app.use(express.static(path.resolve(__dirname, '../client/dist/static'))); 

app.all('*', (req, res) => { 
    res.sendFile(path.resolve(__dirname, '../client/dist', 'index.html')); 
}) 

否則不是express.static應該自動分配內容類型到靜態文件?

回答

0

出於某種原因,不得不現在指定安裝路徑:

app.use('/static', express.static(path.resolve(__dirname, '../client/dist/static')));