diff --git a/README.md b/README.md index 5f451d7..f87f3ad 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,27 @@ -# class-based-helpers-disambiguation +# Helpers disambiguation in Embroider -This README outlines the details of collaborating on this Ember application. -A short introduction of this app could easily go here. +A minimal repro for the issue of helpers breaking when called in the unambiguous way: -## Prerequisites +`{{(translate)}}` -You will need the following things properly installed on your computer. +It turns out that no matter what kind of helper you have (class-based, functional or plain-function), they all break when called as above. -- [Git](https://git-scm.com/) -- [Node.js](https://nodejs.org/) -- [pnpm](https://pnpm.io/) -- [Ember CLI](https://cli.emberjs.com/release/) -- [Google Chrome](https://google.com/chrome/) +**What matters is that `staticHelpers` be set to `false` in the config.** -## Installation +If it is, it breaks with the following: -- `git clone ` this repository -- `cd class-based-helpers-disambiguation` -- `pnpm install` +``` +Uncaught TypeError: func is not a function + at Compilers.compile (opcode-compiler.js:417:1) + at expr (opcode-compiler.js:587:1) + at opcode-compiler.js:1799:1 + at SwitchCases (opcode-compiler.js:943:1) + at opcode-compiler.js:1798:1 + at Compilers.compile (opcode-compiler.js:417:1) + at compileStatements (opcode-compiler.js:2070:1) + at maybeCompile (opcode-compiler.js:2049:1) + at CompilableTemplateImpl.compile (opcode-compiler.js:2032:1) + at Object.evaluate (runtime.js:2973:1) +``` -## Running / Development - -- `pnpm start` -- Visit your app at [http://localhost:4200](http://localhost:4200). -- Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests). - -### Code Generators - -Make use of the many generators for code, try `ember help generate` for more details - -### Running Tests - -- `pnpm test` -- `pnpm test:ember --server` - -### Linting - -- `pnpm lint` -- `pnpm lint:fix` - -### Building - -- `pnpm ember build` (development) -- `pnpm build` (production) - -### Deploying - -Specify what it takes to deploy your app. - -## Further Reading / Useful Links - -- [ember.js](https://emberjs.com/) -- [ember-cli](https://cli.emberjs.com/release/) -- Development Browser Extensions - - [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi) - - [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/) +If the `staticHelpers` is set to `true`, it works fine. diff --git a/app/helpers/functional-translate.ts b/app/helpers/functional-translate.ts new file mode 100644 index 0000000..44ea2c0 --- /dev/null +++ b/app/helpers/functional-translate.ts @@ -0,0 +1,7 @@ +import { helper } from '@ember/component/helper'; + +export function functionalTranslate() { + return 'Papillon'; +} + +export default helper(functionalTranslate); diff --git a/app/helpers/plain-fn-translate.ts b/app/helpers/plain-fn-translate.ts new file mode 100644 index 0000000..73f742c --- /dev/null +++ b/app/helpers/plain-fn-translate.ts @@ -0,0 +1,3 @@ +export default function substring() { + return 'Papillon'; +} diff --git a/app/templates/index.hbs b/app/templates/index.hbs index bd613d8..2644e5b 100644 --- a/app/templates/index.hbs +++ b/app/templates/index.hbs @@ -34,4 +34,7 @@ > {{(translate)}} + {{(functional-translate)}} + {{(plain-fn-translate)}} + \ No newline at end of file diff --git a/ember-cli-build.js b/ember-cli-build.js index b8b3e37..f3fc83d 100644 --- a/ember-cli-build.js +++ b/ember-cli-build.js @@ -11,9 +11,9 @@ module.exports = function (defaults) { return require('@embroider/compat').compatBuild(app, Webpack, { staticAddonTestSupportTrees: true, staticAddonTrees: true, - staticHelpers: true, - staticModifiers: true, - staticComponents: true, + staticHelpers: false, + staticModifiers: false, + staticComponents: false, staticEmberSource: true, skipBabel: [ {