Open yuxinyu12345 opened 2 years ago
i solved the problem. use not import $ from 'jquery'
,because i use local files. The solution is as follows:
yarn add jquery
Vite/CRXJS only support ES modules currently, but support for plain script files like JQuery is on the roadmap.
Vite/CRXJS only support ES modules currently, but support for plain script files like JQuery is on the roadmap.
Thank you for your reply
Build tool
Vite
Where do you see the problem?
Describe the bug
"content_scripts": [ { "js": [ "src/lib/jquery-3.3.1.min", "src/index.js" ], "matches": [ "://.baidu.com/*" ] } ]
The dev environment can use $, but the build dist cannot.
Reproduction
Error in event handler: ReferenceError: $ is not defined at e (chrome-extension://omedgkhbnladahaodjdiojnbmiablmip/assets/index.js.561d4845.js:1:104)
test demo https://github.com/yuxinyu12345/crxjs-demo
Logs
No response
System Info
Severity
blocking an upgrade