ember-cli-mirage: breaks when using ember-data 4.8.0

I upgraded ember-data from 4.7 to 4.8.0. When building the app, I see the following build error, which traces back to ember-cli-mirage. Downgrading ember-data to 4.7.0 fixes the issue.

Dang! Looks like a Build Error.

@embroider/macros/runtime.js

myapp/@embroider/macros/runtime.js: @babel/template placeholder "SAMPLE_FEATURE_FLAG": Expected string substitutionError: @babel/template placeholder "SAMPLE_FEATURE_FLAG": Expected string substitution
    at applyReplacement (myapp/node_modules/@babel/template/lib/populate.js:74:13)
    at myapp/node_modules/@babel/template/lib/populate.js:44:7
    at Array.forEach (<anonymous>)
    at populatePlaceholders (myapp/node_modules/@babel/template/lib/populate.js:42:43)
    at myapp/node_modules/@babel/template/lib/string.js:20:51
    at myapp/node_modules/@babel/template/lib/builder.js:75:14
    at Object.buildLiterals (myapp/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/babel/evaluate-json.js:377:73)
    at Object.inlineRuntimeConfig (myapp/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/babel/get-config.js:107:55)
    at PluginPass.enter (myapp/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/babel/macros-babel-plugin.js:77:38)
    at newFn (myapp/node_modules/@babel/traverse/lib/visitors.js:159:21)
    at NodePath._call (myapp/node_modules/@babel/traverse/lib/path/context.js:46:20)
    at NodePath.call (myapp/node_modules/@babel/traverse/lib/path/context.js:36:17)
    at NodePath.visit (myapp/node_modules/@babel/traverse/lib/path/context.js:84:31)
    at TraversalContext.visitQueue (myapp/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitMultiple (myapp/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (myapp/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (myapp/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (myapp/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (myapp/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitSingle (myapp/node_modules/@babel/traverse/lib/context.js:72:19)
    at TraversalContext.visit (myapp/node_modules/@babel/traverse/lib/context.js:121:19)
    at traverseNode (myapp/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at traverse (myapp/node_modules/@babel/traverse/lib/index.js:50:34)
    at transformFile (myapp/node_modules/@babel/core/lib/transformation/index.js:83:29)
    at transformFile.next (<anonymous>)
    at run (myapp/node_modules/@babel/core/lib/transformation/index.js:24:12)
    at run.next (<anonymous>)
    at transform (myapp/node_modules/@babel/core/lib/transform.js:22:41)
    at transform.next (<anonymous>)
    at evaluateSync (myapp/node_modules/gensync/index.js:251:28)
    at sync (myapp/node_modules/gensync/index.js:89:14)
    at stopHiding - secret - don't use this - v1 (myapp/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js:47:12)
    at Object.transform (myapp/node_modules/@babel/core/lib/transform.js:36:80)
    at myapp/node_modules/broccoli-babel-transpiler/lib/worker.js:12:31
    at tryCatcher (myapp/node_modules/rsvp/dist/rsvp.js:326:21)
    at invokeCallback (myapp/node_modules/rsvp/dist/rsvp.js:498:33)
    at myapp/node_modules/rsvp/dist/rsvp.js:562:16
    at flush (myapp/node_modules/rsvp/dist/rsvp.js:2441:7)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)
    =============
    at Object.buildLiterals (myapp/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/babel/evaluate-json.js:377:34)
    at Object.inlineRuntimeConfig (myapp/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/babel/get-config.js:107:55)
    at PluginPass.enter (myapp/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/babel/macros-babel-plugin.js:77:38)
    at newFn (myapp/node_modules/@babel/traverse/lib/visitors.js:159:21)
    at NodePath._call (myapp/node_modules/@babel/traverse/lib/path/context.js:46:20)
    at NodePath.call (myapp/node_modules/@babel/traverse/lib/path/context.js:36:17)
    at NodePath.visit (myapp/node_modules/@babel/traverse/lib/path/context.js:84:31)
    at TraversalContext.visitQueue (myapp/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitMultiple (myapp/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (myapp/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (myapp/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (myapp/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (myapp/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitSingle (myapp/node_modules/@babel/traverse/lib/context.js:72:19)
    at TraversalContext.visit (myapp/node_modules/@babel/traverse/lib/context.js:121:19)
    at traverseNode (myapp/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at traverse (myapp/node_modules/@babel/traverse/lib/index.js:50:34)
    at transformFile (myapp/node_modules/@babel/core/lib/transformation/index.js:83:29)
    at transformFile.next (<anonymous>)
    at run (myapp/node_modules/@babel/core/lib/transformation/index.js:24:12)
    at run.next (<anonymous>)
    at transform (myapp/node_modules/@babel/core/lib/transform.js:22:41)
    at transform.next (<anonymous>)
    at evaluateSync (myapp/node_modules/gensync/index.js:251:28)
    at sync (myapp/node_modules/gensync/index.js:89:14)
    at stopHiding - secret - don't use this - v1 (myapp/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js:47:12)
    at Object.transform (myapp/node_modules/@babel/core/lib/transform.js:36:80)
    at myapp/node_modules/broccoli-babel-transpiler/lib/worker.js:12:31
    at tryCatcher (myapp/node_modules/rsvp/dist/rsvp.js:326:21)
    at invokeCallback (myapp/node_modules/rsvp/dist/rsvp.js:498:33)
    at myapp/node_modules/rsvp/dist/rsvp.js:562:16
    at flush (myapp/node_modules/rsvp/dist/rsvp.js:2441:7)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 9
  • Comments: 15

Most upvoted comments

I also ended up pinning @embroider/macros to 1.9.0 and the error went away.

SAMPLE_FEATURE_FLAG is not actually defined in this repo. Not sure if it is ember possibly embroider/macros.

This could be an issue with many addons being on different versions of embroider/macros. In my own application I have the following trying to fix this. Curious if you try something like this and update to a later (or latest) version if that might help. I used this to fix ember-cli-babel as well. Since ember-cli-mirage specifies a version of mirage, this also lets me use the higher version of mirage without waiting for ember-cli-mirage to update.

"resolutions": {
    "miragejs": "~0.1.46",
    "@embroider/macros": "^1.9.0",
    "@embroider/util": "^1.9.0",
    "ember-cli-babel": "^7.26.1",
    "@fortawesome/fontawesome-svg-core": "1.2.35"
  }

Please feel free to close. Sorry, but I no longer use mirage.