joi-browser icon indicating copy to clipboard operation
joi-browser copied to clipboard

Thoughts about Webpack Code splitting

Open export-mike opened this issue 7 years ago • 2 comments

Interested to hear any thoughts you have on using joi-browser with webpack code splitting, would it result in lazy loading? or would it end up where everything is required upfront?

export-mike avatar May 22 '17 09:05 export-mike

For example purposes: where you use a method that requires 'moment' or some other heavy dependency

function date() { require.ensure('moment') }

export-mike avatar May 22 '17 09:05 export-mike

I think the biggest issue is that everything that uses moment is expecting it to be available via synchronous require so the require.ensure returns a promise that one must wait for. So the code wouldn't be compatible as is. It would be nice if it was that easy.

jeffbski avatar Jun 03 '17 22:06 jeffbski