the development environment is based on the vue+webpack environment, and now there is a requirement to import Excel locally, then parse it into json, and save it to the database. Parse the Excel file using the xlsx plug-in.
however, considering that when the amount of Excel data is too large, the parsing process will be very long, resulting in page stuttering, so it is decided to hand over the parsing process to webworker . However, there is a problem that import
cannot be used in webworker , and the sentence import XLSX from "xlsx"
is not valid.
uses var XLSX = importScripts ("/ node_modules/xlsx/xlsx.js")
, but the return value is undefined
.
I checked for a long time, but I didn"t find it. I wonder if any of the great gods have solved similar problems.