Skip to content

Implement dynamic import support

Compare
Choose a tag to compare
@ahamedalthaf ahamedalthaf released this 22 Jul 09:09
· 1 commit to main since this release
76c225c

Implement dynamic import support

Flatpickr module is getting included in vendor file even though we are doing auto import. It should be ignored when we do an auto import of flatpickr.

This PR will help to exclude the flatpickr module in vendor file if client is using auto import functionality.

Example:

ember-cli-build.js

'use strict';

const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function (defaults) {

  let app = new EmberAddon(defaults, options);

  /*
    This build file specifies the options for the dummy test app of this
    addon, located in `/tests/dummy`
    This build file does *not* influence how the addon or the app using it
    behave. You most likely want to be modifying `./index.js` or app's build file
  */

  flatpickr: {
    includeInVendor: false // true or false should decide whether it needs to be included in vendor file or not.
  }
};

In a specific route file where we need to use flatpickr

import Route from '@ember/routing/route';

export default Route.extend({
  model() {
    return import('flatpickr').then((module) => module.default);
  }
});