Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hulumeijiu opened this issue Mar 31, 2022 · 8 comments
Open

Comments

@hulumeijiu
Copy link

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

@panyanxin
Copy link

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

@ycy1621260121
Copy link

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
Copy link

按照你的操作会出现下面的异常:
index.ts:41 ReferenceError: QUOTE is not defined
at xlsx.js:12065:19
at make_xlsx (xlsx.js:12097:1)
at node_modules/.pnpm/[email protected]/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
Copy link

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

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

@1029800858
Copy link

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。每次修改源码不现实

@hulumeijiu
Copy link
Author

hulumeijiu commented Apr 11, 2024 via email

@1029800858
Copy link

是的,我后面才知道

---原始邮件--- 发件人: @.> 发送时间: 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上是怎么配的呢,能否参考一下。

@hulumeijiu
Copy link
Author

是的,我后面才知道

---原始邮件--- 发件人: @.> 发送时间: 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上是怎么配的呢,能否参考一下。

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants