Skip to content

Commit

Permalink
fix(core): fix getWindow/Document getters in lazy components
Browse files Browse the repository at this point in the history
fixes #4052
  • Loading branch information
nolimits4web committed Jun 23, 2022
1 parent 577e69c commit 41a7c50
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/build-core-lazy-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ function buildLazyComponentsJs(components, cb) {
.join('\n');
fileContent = fileContent
.replace(/var window = getWindow\(\);/g, '')
.replace(/var document = getDocument\(\);/g, '');
.replace(/var document = getDocument\(\);/g, '')
.replace(/getDocument\(\);/g, 'document')
.replace(/getWindow\(\);/g, 'window');

fileContent = `${fileIntro}\n ${fileContent.trim()}${outro}`;
if (fileName.indexOf('swiper') >= 0) {
Expand Down

1 comment on commit 41a7c50

@AndreyVasilkov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in components/lazy/lazy.js
before:
const window = getWindow();
after replace:
const window = window

without semicolon and ReferenceError: Cannot access 'window' before initialization

Please sign in to comment.