Я использую csv-loader
с Vue, чтобы попытаться загрузить мой файл 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)
Это мой импорт файла
// component.vue
import XLSTemplate from "@/assets/template/template.xlsx";
Я пытался использовать относительную ссылку, но он не находит мой файл
<a href="../../../assets/template/template.xlsx" download>download</a>
Это мой webpack.config.js
module.exports = {
module: {
rules: [
{
test: /\.scss$/,
use: ["vue-style-loader", "css-loader", "sass-loader"]
},
{
test: /\.csv$/,
loader: 'csv-loader',
options: {
dynamicTyping: true,
header: true,
skipEmptyLines: true
}
},
{
test: /\.(csv|xlsx|xls)$/,
loader: 'file-loader',
options: {
name: `files/[name].[ext]`
}
}
],
},
};
Я неправильно добавляю правило в веб-пакет?