After summer 19 upgrade unable to import LWC components in managed package - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Alex ZAlex Z 

After summer 19 upgrade unable to import LWC components in managed package

There is an issue that seems to only affect orgs that are developing managed packages. What happens is if you have one custom component import another custom component, the js can't compile as it can't find the module (for whatever reason now?)
To replicate this, do the following in Summer 19:
1) Create the first component (e.g. here called TestCo)
Html
<template> Hello world! </template>

Js

import { LightningElement } from 'lwc'; 
export default class TestCo extendsLightningElement {}

Metadata

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="testCo">
<apiVersion>45.0</apiVersion>
<isExposed>false</isExposed> 
</LightningComponentBundle>

2) Create the second component (here called DummyEditor)
Html

<template> <c-test-co></c-test-co> </template>

Js

import { LightningElement, api, wire, track } from "lwc";
import { TestCo } from 'c/testCo'; // note: this doesn't make any difference 
export default class DummyEditor extends LightningElement { }

Metadata

<?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundlexmlns="http://soap.sforce.com/2006/04/metadata" fqn="dummyEditor"><apiVersion>45.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>DUMMY</masterLabel>
<targets>
  <target>lightning__RecordPage</target>
</targets>
</LightningComponentBundle>

3) Now add the second component anywhere to a LWC record page
4) Try to open the record (note: it WILL work in App Builder, but not in the console)


Trying to repro this in a brand new dev org I first added this component to Account object - THAT worked. However, when i created a Custom object, and added the component to that - it fails the same way.
So there is definitely an issue, and it is reproducible on a brand new org, the conditions are:

1) Dev org
2) My Domain enabled (so LWC can work)
3) Managed package enabled -> namespace + package created, package can be empty
4) Custom object
5) The components as per above
6) LWC record page for CUSTOM object contains these components

Best Answer chosen by Alex Z
Carl BrundageCarl Brundage
This same issue starting occuring for me after the Summer 19 release.  I am working in a namespaced scratch org, as part of managed package development.  I have a case open with support.

My LWC that contains another LWC produces a GACK/internal error when viewed.  The component displays properly when setting up the page in Lightning.

Using Amit's example, I was able to narrow down the steps to reproduce. I created two "Hello World" LWC.  One with a camelCase name and one without. The naming turns out to be very important
  • compone
  • compTwo
I added each Hello World to a separate parent LWC with the appropriate reference.  These components are available for use on record pages.
  • Works
    • <c-compone></c-compone>
  • Breaks
    • <c-comp-two></c-comp-two>

When Works is placed on the lightning page, it does display.  Using a non-camel case name, which does not require the - when referencing is the key.  Once Breaks is placed on the page, a internal error is produced. 

Additionally, this only occurs on custom objects.  If the components are placed on a standard object, both parent LWCs work.

Finally, this does have to be in an org with a name space.  It failed for me in a dev org with a namespace.  It worked in a dev org without a name space.

All Answers

Amit SinghAmit Singh
In case of Managed Package c must be replaced with the name of the Custom Name Space
Alex ZAlex Z

This doesn't seem to work as i can't deploy my component via SFDX if i replace `<c-test-co>` with `seafoodbar_x-test-co` (my namespace here is `seafoodbar_x`). I even tried `seafoodbar-x-test-co`.

 

Also, is that change documented anywhere? this was working just fine last week until Summer 19 release.

Carl BrundageCarl Brundage
This same issue starting occuring for me after the Summer 19 release.  I am working in a namespaced scratch org, as part of managed package development.  I have a case open with support.

My LWC that contains another LWC produces a GACK/internal error when viewed.  The component displays properly when setting up the page in Lightning.

Using Amit's example, I was able to narrow down the steps to reproduce. I created two "Hello World" LWC.  One with a camelCase name and one without. The naming turns out to be very important
  • compone
  • compTwo
I added each Hello World to a separate parent LWC with the appropriate reference.  These components are available for use on record pages.
  • Works
    • <c-compone></c-compone>
  • Breaks
    • <c-comp-two></c-comp-two>

When Works is placed on the lightning page, it does display.  Using a non-camel case name, which does not require the - when referencing is the key.  Once Breaks is placed on the page, a internal error is produced. 

Additionally, this only occurs on custom objects.  If the components are placed on a standard object, both parent LWCs work.

Finally, this does have to be in an org with a name space.  It failed for me in a dev org with a namespace.  It worked in a dev org without a name space.
This was selected as the best answer
Alex ZAlex Z
@Carl Brundage this does seem to have worked; sadly there are tons of components I have to rename now but at least that is a way forward. Thanks heaps!
Uday BikkumallaUday Bikkumalla
Thanks @Carl Brundage. Is this a bug from Salesforce? Did you get any update from Salesforce support on this? I am afraid to change all my component names if it turns out to a bug.
Alex ZAlex Z

@Uday Bikkumalla, 

Yes, Salesforce support confirmed to me this is a bug. It is at least another week before the fix will be deployed, though.

Uday KumarUday Kumar
Thank you @Alex Z
Brent BowersBrent Bowers
Any update on the timing of this, based on your support ticket, @Alex Z?  Do you know if they've created a "Known Issue" for it yet, so that the community can follow along and get updates?  This has been a big issue for us.
Carl BrundageCarl Brundage
Response on the case is that a known issue won't be created as it doesn't effect enough customers.  It is supposed to be fixed soon.
Carl BrundageCarl Brundage
A fix has been applied to sandboxes.  My components are working again in scratch orgs.
Brent BowersBrent Bowers
@Carl Brundage, love the updates. Thanks again. If it helps them get this patch to Production more quickly, please do let them know their fix has solved my problem in a Full sandbox on instance CS1.
Carl BrundageCarl Brundage
Support thought tonight or tommorow (subject to change).  It appears it's part of Patch 11, which can be tracked here - https://success.salesforce.com/issues_releases_view?release=220011000
Carl BrundageCarl Brundage
Release was rolled back including sandboxes.  The release status is being updated with the latest info.
Brent BowersBrent Bowers
Was it?  Interesting, the LWC that failed to deploy (because of its camelCased name) prior to the fix, but deployed after the fix and is STILL deploying successfully this morning, even though I'm on an instance/pod (CS1) that says the release has been rolled back for.
Carl BrundageCarl Brundage
I never had an issue deploying.  Viewing the page with the LWC produced the internal server error (-1122514613), which is back again in scratch orgs.  The LWC was fine in app builder as well.
Carl BrundageCarl Brundage
Looks like the release was applied again to most sandboxes and NA prod instanced.  Unfortunately, not the sandbox (CS90) that my scratch org is on. I created a new scratch org and the component no longer produces an error.  

There is a related issue with parent/child LWC, custom labels and namespaces, which is being discussed here - https://success.salesforce.com/answers?id=9063A000000ZzvZQAS
Alex ZAlex Z
This was definitely deployed to prod in APAC, my org is working fine once again.
Uday KumarUday Kumar
@Alex Z, I have installed the package in AP15 instance and still not working. Can you please let me know the apac instance of your org? Any idea of the patch version?
Aard-Jan van KesterenAard-Jan van Kesteren
I still have this issue on CS100, which is on patch Summer '19 12.4. Anyone else has this issue? 
Uday KumarUday Kumar
Anybody has any idea if this is still an issue? I have installed the package and still receiving the internal server error when I load the component.
Alex ZAlex Z

@Uday Kumar, my issue was in my dev org, but unfortunately now that i have come to package it, i am experiencing the same again.

Did it work for you when INSTALLED in a manage package?