Skip to content

Commit a0d5ac7

Browse files
committed
feat: make lazyload better
1 parent 24f5766 commit a0d5ac7

3 files changed

Lines changed: 12 additions & 215 deletions

File tree

packages/vue3/source/index.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<body>
1919
<div id="app"></div>
2020
<script>
21-
var LazyLoad = (function (doc) {
21+
var LazyLoad = (function (doc) {
2222
var env,
2323
head,
2424
pending = {},
@@ -213,6 +213,17 @@
213213
} else {
214214
urls && preload(urls);
215215
}
216+
},
217+
reset: function () {
218+
env = undefined;
219+
head = undefined;
220+
pending = {};
221+
pollCount = 0;
222+
queue = {
223+
css: [],
224+
js: []
225+
};
226+
styleSheets = doc.styleSheets;
216227
}
217228
};
218229
})(this.document);

packages/vue3/source/rspack/plugins/lcap/constant.js

Lines changed: 0 additions & 211 deletions
This file was deleted.

packages/vue3/source/rspack/plugins/lcap/index.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const rspack = require('@rspack/core');
2-
const { lazyLoadCode } = require('./constant');
32

43
const plugin = 'lcap-plugin';
54

@@ -139,8 +138,6 @@ function emitClientResource(compiler, options) {
139138
];
140139

141140
const clientCode = `(function() {
142-
${lazyLoadCode}
143-
144141
function loadAssets() {
145142
// chunksMap
146143
${isDev} && LazyLoad.js(["${publicPath}router.min.js"].map(item => {

0 commit comments

Comments
 (0)