File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
packages/wrapped-keys-lit-actions Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,20 @@ const wrapIIFEInStringPlugin = {
2525 result . outputFiles . forEach ( ( outputFile ) => {
2626 let content = outputFile . text ;
2727
28+ // IMPORTANT: if minify is disabled, we need to:
29+ // 1. remove var import_ethers = __require("ethers");
30+ // 2. remove import_ethers.
31+ content = content
32+ . replace ( / v a r i m p o r t _ e t h e r s = _ _ r e q u i r e \( " e t h e r s " \) ; / g, '' )
33+ . replace ( / i m p o r t _ e t h e r s \. / g, '' ) ;
34+
35+ // IMPORTANT: if minify is enabled, we need to:
36+ // 1. remove var t=o(\"ethers\");
37+ // 2. replace t.ethers to ethers
38+ content = content
39+ . replace ( / v a r \s + \w + = \w + \( " e t h e r s " \) ; / g, '' )
40+ . replace ( / [ a - z A - Z ] \. e t h e r s / g, 'ethers' ) ;
41+
2842 // Use JSON.stringify to safely encode the content
2943 const wrappedContent = `/**
3044 * DO NOT EDIT THIS FILE. IT IS GENERATED ON BUILD. RUN \`yarn generate-lit-actions\` IN THE ROOT DIRECTORY TO UPDATE THIS FILE.
You can’t perform that action at this time.
0 commit comments