function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Alex Z 16Alex Z 16 

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 extends LightningElement {}


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"?> <LightningComponentBundle xmlns="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 below
6) LWC record page for CUSTOM object contains these components