How to write and use a helper in a module unification app?


#1

I’m using ember-cli 3.4.0-beta.1

In a module unification app, when I use a generator to create a helper, it puts it in the old, non-module-unification app/helpers directory:

> MODULE_UNIFICATION=true EMBER_CLI_MODULE_UNIFICATION=true ember g helper myhelper
installing helper
  create app/helpers/myhelper.js
installing helper-test
  create tests/integration/helpers/myhelper-test.js

I also tried manually creating the file src/ui/components/myhelper.js (this is what I gathered it should be from reading the RFC) with the following contents:

import { helper } from '@ember/component/helper';

export function myhelper(/* params, hash*/) {
  return 'stuff';
}

export default helper(myhelper);

Then, in my template I call the helper as {{myhelper}}. This all builds, but in the browser it gives me the following error:

Uncaught Error: Compile Error: myhelper is not a helper.

Is module unification not implemented yet for helpers, or am I doing something wrong? What is the right way to make a module-unification-style helper?

Thanks!