dojo / cli-build-webpack

🚀 **DEPRECATED** Dojo 2 - cli command for building applications
http://dojo.io
Other
4 stars 19 forks source link

Add imports() support #214

Closed matt-gadd closed 7 years ago

matt-gadd commented 7 years ago

Type: feature

The following has been addressed in the PR:

Description: This adds support for using import() over @dojo/core/load in projects. It supports automatic lazy widget bundling, as well as bundles defined in the .dojorc like the existing functionality via @dojo/core/load.

This will mean users can now do:

registry.define('my-widget', async function () {
    const Module = await import('./MyWidget');
    return Module.default;
});

over:

import load from '@dojo/core/load';
registry.define('my-widget', () => {
    return load(require, './MyWidget').then(([ MyWidget ]) => MyWidget.default);
});

Although this doesn't change much to an end user, we are at least using a standard, and it will eventually mean we can remove a fair amount of code from cli-build (https://github.com/dojo/cli-build-webpack/pull/89, https://github.com/dojo/cli-build-webpack/pull/92)