question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Stencil component importing @ionic/core is breaking @ionic/angular application that has tabs.

See original GitHub issue

Bug Report

Ionic version:

[x] 4.11.2

Current behavior: Breaking change (ion-tabs) - @ionic/core is fetching tabs list using the ‘ion-tab’ selector which does not exist in ionic/angular

Expected behavior: On application load, the ionic/core tabs.entry.js file code is executed. The list of tabs is retrieved using the ‘ion-tab’ selector which is not part of ionic 4.

Steps to reproduce:

  1. Clone repo
  2. npm install
  3. ionic serve

Open console to check the tabs exception being thrown by the tabs.entry.js file.

Stencil @stencil/core: 1.7.3 Stencil component code

Ionic info:

Ionic:

   Ionic CLI                     : 5.4.4 (C:\Users\Sanaa\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.11.1
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.0.0

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v10.16.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.9.0
   OS     : Windows 10

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
corysmccommented, Jun 10, 2020

We’re seeing this issue as well. Creating a component that is meant to be used inside an ionic app - so I was hoping to only include ionic components as dev dependencies. but it looks like it’s being included in the build - which causes conflicts in the angular app.

2reactions
adrianfalleirocommented, Jun 25, 2020

I think I’ve been able to find workarounds to this issue for both library authors and consumers.

For library consumers You can exclude components from being bootstrapped at runtime by the stencil component loader by passing some additional params to the defineCustomElements() function as follows.

defineCustomElements(window, {
  exclude: ['ion-tabs', 'ion-tab'],
});

I’ve got a working version of the reference repo from @sanaadostmuhammad https://github.com/adrianfalleiro/stencil-ionic-angular

For library authors It looks like there is a little documented config property named excludeUnusedDependencies. Enabling this excludes unused components chunks from being emitted and excludes them from being added to the lazy loader.

This is my stencil.config.js.

import { Config } from '@stencil/core';

export const config: Config = {
  namespace: 'test',
  taskQueue: 'async',
  excludeUnusedDependencies: true,
  outputTargets: [
    {
      type: 'dist',
      esmLoaderPath: '../loader'
    },
    {
      type: 'docs-readme'
    },
    {
      type: 'www',
      serviceWorker: null // disable service workers
    },
  ]
};

I’m not a library author, so can’t 100% vouch for this, but you can see my example project. https://github.com/adrianfalleiro/stencil-exclude-unused-dependencies

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: Stencil component importing @ionic/core is breaking ...
Expected behavior: On application load, the ionic/core tabs.entry.js file code is executed. The list of tabs is retrieved using the 'ion-tab' ...
Read more >
Ionic router/tabs not loading stencil
Can't get component to load in tab using Stencil and Ionic (router, tabs). The code below is based on the Stencil Conference App....
Read more >
@ionic/core | Yarn - Package Manager
Ionic is an open source app development toolkit for building modern, fast, top-quality cross-platform native and Progressive Web Apps from a single codebase ......
Read more >
You searched for Typescript - Ionic Blog
That means no more app store delays, quicker bug fixes and content changes, and ensuring ... import { Component, h } from '@stencil/core';...
Read more >
signature=14611b395b980b0944234a35b2c772db,ionic ...
all: overlay components no longer display outline when focused ... ios: large title transition works properly in tabbed applications ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found