Import errors when importing '@ionic/core' specific method from a stencil component

I want to change the behavior of an ionic4 web component.

I created a stencil component from stencil-component-starter and copied the source of the component (ion-reorder in my case) from ‘@ionic/core/src/components’.

To make it work, I need to fix this import : import { getIonMode } from '../../global/ionic-global'

I installed @ionic/core as dependence and tried many ways to import :

  • import { getIonMode } from '@ionic/core/dist/types/global/ionic-global';

returns a TypeError :

TypeError: Failed to resolve module specifier "@ionic/core/dist/types/global/ionic-global". Relative references must start with either "/", "./", or "../".

So I tried to directly import from node_modules

  • import { getIonMode } from '../../../node_modules/@ionic/core/dist/types/global/ionic-global';

but it returns a rollup import error :

Rollup: Unresolved Import Could not resolve '../../../node_modules/@ionic/core/dist/types/global/ionic-global' from src/components/reorder/lazy_7lathtd3dfwla7hdtr7reg-reorder.js

I also tried to import the Ionic/core module : import * as Ionic from '@ionic/core'; But it doesn’t provide the method getIonMode() that I need.

Perhaps I miss something in the import process ?

Any help or hint appreciated :pray:

Hey, Did you solve this?