Splitting issue
- Dominant language
- Go
- Stars
- 40.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
My script is as below. Basically it appears that the daygrid plugin is being imported before the core library as I am getting the following output:
```
Hello 0
application-5a1d12524f6b033311d88050725fe217d18e8e926cc71516632699689f192462.js:26 Error: Please import the top-level fullcalendar lib before attempting to import a plugin.
at vdom.js:3:11
```
```
(async () => {
try {
console.log('Hello 0');
const { Calendar } = await import('@fullcalendar/core');
console.log('Hello 1');
const dayGridPlugin = (await import('@fullcalendar/daygrid')).default;
console.log('Hello 2');
let calendarEl = document.getElementById('calendar');
let calendar = new Calendar(calendarEl, {
plugins: [dayGridPlugin],
firstDay: 1,
contentHeight: "auto",
aspectRatio: 1.5,
startParam: 'start',
endParam: 'end',
showNonCurrentDates: true,
headerToolbar: {
start: 'title',
center: 'prevYear,nextYear',
end: 'today prev,next'
}
});
calendar.render();
} catch (error) {
console.log(error);
}
})();
```
Any suggestions as to how to fix this? Without splitting, all the code is combined into one large file which is severely hurting the performance of my site. I really need to only load external frameworks only at the times I need them using splitting like this.
Thanks,
Neil
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the supplied script and its dynamic imports of @fullcalendar/core and @fullcalendar/daygrid, then reproduce the import-order error with code splitting enabled. Trace the generated split modules and their loading order; done means the split build loads the core library before the plugin without combining all external frameworks into one file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100