protobi / js-xlsx

XLSX / XLSM / XLSB (Excel 2007+ Spreadsheet) / ODS parser and writer
http://oss.sheetjs.com/js-xlsx
Other
814 stars 416 forks source link

vite上怎么配置config.externals({ "./cptable": "var cptable" }); #168

Open yjwyz opened 2 years ago

yjwyz commented 2 years ago

vite上怎么配置config.externals({ "./cptable": "var cptable" });

panyanxin commented 1 year ago

vite上怎么配置config.externals({ "./cptable": "var cptable" });

ycy1621260121 commented 1 year ago

npm install xlsx-style-hzx 1、cpexcel.js 的807行 var cpt = require('./cpt' + 'able') 改为 var cpt = require('./cpexcel'); 2、xlsx.js中var current_codepage = 1200, current_cptable;加上一个cptable;即var current_codepage = 1200, current_cptable, cptable;

zhanghuning commented 10 months ago

按照你的操作会出现下面的异常: index.ts:41 ReferenceError: QUOTE is not defined at xlsx.js:12065:19 at make_xlsx (xlsx.js:12097:1) at node_modules/.pnpm/registry.npmmirror.com+xlsx-style@0.8.13/node_modules/xlsx-style/xlsx.js (xlsx.js:12487:1) at __require2 (chunk-AUZ3RYOM.js?v=615823df:18:50) at xlsx.js:12487:51

1029800858 commented 2 months ago

vite上怎么配置config.externals({ "./cptable": "var cptable" });

请问解决了嘛? vite上怎么配置

1029800858 commented 2 months ago

npm install xlsx-style-hzx 1、cpexcel.js 的807行 var cpt = require('./cpt' + 'able') 改为 var cpt = require('./cpexcel'); 2、xlsx.js中var current_codepage = 1200, current_cptable;加上一个cptable;即var current_codepage = 1200, current_cptable, cptable;

修改源码的方式不是最好的解决方案。项目基于giltLab的CI/CD。每次修改源码不现实

yjwyz commented 2 months ago

是的,我后面才知道

---原始邮件--- 发件人: @.> 发送时间: 2024年4月11日(周四) 上午10:23 收件人: @.>; 抄送: @.**@.>; 主题: Re: [protobi/js-xlsx] vite上怎么配置config.externals({ "./cptable": "var cptable" }); (Issue #168)

npm install xlsx-style-hzx 1、cpexcel.js 的807行 var cpt = require('./cpt' + 'able') 改为 var cpt = require('./cpexcel'); 2、xlsx.js中var current_codepage = 1200, current_cptable;加上一个cptable;即var current_codepage = 1200, current_cptable, cptable;

修改源码的方式不是最好的解决方案。项目基于giltLab的CI/CD。每次修改源码不现实

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

1029800858 commented 2 months ago

是的,我后面才知道 ---原始邮件--- 发件人: @.> 发送时间: 2024年4月11日(周四) 上午10:23 收件人: @.>; 抄送: @.**@.>; 主题: Re: [protobi/js-xlsx] vite上怎么配置config.externals({ "./cptable": "var cptable" }); (Issue #168) npm install xlsx-style-hzx 1、cpexcel.js 的807行 var cpt = require('./cpt' + 'able') 改为 var cpt = require('./cpexcel'); 2、xlsx.js中var current_codepage = 1200, current_cptable;加上一个cptable;即var current_codepage = 1200, current_cptable, cptable; 修改源码的方式不是最好的解决方案。项目基于giltLab的CI/CD。每次修改源码不现实 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

所以vite上是怎么配的呢,能否参考一下。

yjwyz commented 2 months ago

是的,我后面才知道 ---原始邮件--- 发件人: @.**> 发送时间: 2024年4月11日(周四) 上午10:23 收件人: @.**>; 抄送: @.**@.**>; 主题: Re: [protobi/js-xlsx] vite上怎么配置config.externals({ "./cptable": "var cptable" }); (Issue #168) npm install xlsx-style-hzx 1、cpexcel.js 的807行 var cpt = require('./cpt' + 'able') 改为 var cpt = require('./cpexcel'); 2、xlsx.js中var current_codepage = 1200, current_cptable;加上一个cptable;即var current_codepage = 1200, currentcptable, cptable; 修改源码的方式不是最好的解决方案。项目基于giltLab的CI/CD。每次修改源码不现实 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @_.***>

所以vite上是怎么配的呢,能否参考一下。

刚想起来还没回复你,抱歉,下面是我在webpack vue2环境下的配置,至于vite,我还没有在上面使用过,不过原理应该都一样,找到相同属性的配置就行了吧

// vue.config.js module.exports = { ... configureWebpack: { name: name, resolve: { alias: { "@": resolve("src") } }, externals: [ { './cptable': 'var cptable' // 我加了这个就可以了,vue2 webpack } ] }, ... };