code: function makeLegacyEnsure ({references, state, babel, referencePath}) {
    const brokerTemplate = babel.template.smart(`
      (typeof Broker !== 'undefined' ? Broker : require('${pkgName}').default)(
        PROMISES,
        OPTIONS
      )
    `, {preserveComments: true})
  
    const {promises, options} = parseArguments(
      referencePath.parentPath.get('arguments'),
      state,
      babel
    )
  
    // component options are always in the second argument
    // let options = referencePath.parentPath.get('arguments')[1]
    // options = options && options.expression
  
    // replaces the macro with the new broker template in the source code
    referencePath.parentPath.replaceWith(
      brokerTemplate({
        PROMISES: toObjectExpression(promises, babel),
        OPTIONS: options
      })
    )
  
    referencePath.parentPath.get('arguments')[0].get('properties').forEach(
      prop => {
        // this adds webpack magic comment for chunks names
        // prop.get('key') is the key of the current property
        // prop.get('value') is the value of the current property
        //     .get('value').get('body') is the import() call expression
        //     .get('arguments')[0] is the first argument of the import(), which is the source
        prop.get('value').get('body').get('arguments')[0].addComment(
          "leading",
          ` webpackChunkName: ${prop.get('key')} `
        )
      }
    )
  }
docs: if Broker is defined in the scope then it will use that Broker, otherwise it requires the module.