首页 > 解决方案 > 模块解析失败:意外字符 '' (1:2) 您可能需要适当的加载程序来处理此文件类型

问题描述

我试图将 .xlsx 文件粘贴到assets/files/vue 中,然后出现此错误

warning  in ./src/assets/files/example-format.xlsx

Module parse failed: Unexpected character '' (1:2)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)

 @ ./src/assets sync ^\.\/.*$
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.1.131:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

我该如何解决?太感谢了

标签: vue.jsvuejs2

解决方案


将 .xlsx 文件放入public目录中,然后<a href="/demo.xlsx">Download</a>,如果您只想让其他人下载它


推荐阅读