Using webworker to reference the corresponding package in node_modules, the problem cannot be referenced

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.

Apr.18,2022

to use packages in the node environment in browsers, configure the packaged build environment, such as rollup, webpack, browserify, and so on.

Menu