Skip to content

Commit d419269

Browse files
committed
feat: use .lazy prefix for browser loaded JS lazy components
1 parent 2cdca03 commit d419269

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

scripts/build-core-lazy-components.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ function buildLazyComponentsJs(components, cb) {
244244
fileContent = `(${fileContent}(Framework7, typeof Framework7AutoInstallComponent === 'undefined' ? undefined : Framework7AutoInstallComponent))`;
245245

246246
fs.writeFileSync(
247-
`${output}/components/${fileName.split('.js')[0]}/${fileName.replace('.js', '.umd.js')}`,
247+
`${output}/components/${fileName.split('.js')[0]}/${fileName.replace('.js', '.lazy.js')}`,
248248
`${fileContent}\n`,
249249
);
250250

src/core/components/app/load-module.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function loadModule(moduleToLoad) {
4141
);
4242
return;
4343
}
44-
modulePath = `${app.params.lazyModulesPath}/${moduleToLoad}/${moduleToLoad}.js`;
44+
modulePath = `${app.params.lazyModulesPath}/${moduleToLoad}/${moduleToLoad}.lazy.js`;
4545
} else {
4646
modulePath = moduleToLoad;
4747
}
@@ -134,7 +134,9 @@ function loadModule(moduleToLoad) {
134134
});
135135
const styleLoad = new Promise((resolveStyle) => {
136136
Framework7.request.get(
137-
modulePath.replace('.js', app.rtl ? '.rtl.css' : '.css'),
137+
modulePath
138+
.replace('.lazy.js', app.rtl ? '.rtl.css' : '.css')
139+
.replace('.js', app.rtl ? '.rtl.css' : '.css'),
138140
(styleContent) => {
139141
const styleEl = document.createElement('style');
140142
styleEl.innerHTML = styleContent;

0 commit comments

Comments
 (0)