#How do I use functions from @ember/debug or @ember/destroyable when those packages do not exist?

1 messages · Page 1 of 1 (latest)

fair harness
#

Is there a parent package that contains @ember/debug and @ember/destroyable? Do I need to install ember-cli?

gilded dawn
#

I think they’re in ember-source

#

I appear to be unable to share images here but I confirmed this by using the “explore” view on npm, they’re in dist/packages/@ember

fair harness
#

Thanks!

#

going to try this

gilded dawn
#

are you working outside an Ember CLI context? Normally these things all come automatically in the Ember CLI blueprint

#

something maybe confusing is that you would import { destroy } from '@ember/destroyable', so it being ember-source underneath is not clear

fair harness
#

yeah I am trying to work on an issue where it's not an ember app but an addon for ember and it just needs to use some functions from those two ^^ packages...it threw me off a little that they aren't separate installable packages without ember-source

fair harness
#

Back again...so I tried installing ember-source and @ember/string but I am getting the following build error:

(0, string_1.camelize) is not a function
gilded dawn
#

what’s your import statement? What version of Ember?

fair harness
#

latest version of ember-source

#
import { camelize } from '@ember/string'
gilded dawn
#

hmm… are there other imports from '@ember/? I would expect them to all work the same way

fair harness
#

there was also @ember/debug but that also failed

gilded dawn
#

is this a true Ember addon? I think the “resolver” is the thing that translates these imports to ember-source underneath

fair harness
gilded dawn
#

ah okay. I think it’s not v2 since it doesn’t have that in package.json (ember-addon.version)

#

how are you running the code?

fair harness
#

yarn start

#

looks like that runs ember serve

gilded dawn
#

mysterious… this gets pretty hideous but sometimes when imports aren’t working I do things like

import X from '@ember/string`;
console.log('import', X);

or even
window.stringImport = X
so I can poke around at it

#

also josemarluedke does exist here haha

fair harness
#

Okay going to try this!

#

what IS window.stringImport??

gilded dawn
#

you can call it anything, I just attach it to window so I can see the shape of it

fair harness
#

oh I see

fair harness
#
import * as emberString from '@ember/string';
console.log({emberString})

// prints
{
 emberString: {
  name: [Getter],
  treeForAddon: [Getter],
  default: { name: '@ember/string', treeForAddon: [Function treeForAddon]
 }
}
gilded dawn
#

hmm that seems v wrong 😳

fair harness
#

I'm honestly super confused as to what's going on, so any tips (even guessing) would be appreciated lol

gilded dawn
fair harness
#

I had that installed along with ember-source but the versions don't match up (the latest of @ember/string seems to be 3.0.1 or something)

Right now rolling that back and trying again just with ember-source

#

Okay without @ember.string it's saying Cannot find module @ember/string (this is with ember-source installed)

gilded dawn
#

whaaa

#

what version of ember-resolver do you have?

fair harness
#

looks like "^8.0.3"

#

I guess I could try bumping ember-resolver to 10 because it looks like the ember-source in this repo is at version 4+