0

I am unable to use the LWC in the subscriber org. The component is using a JS script and style sheet. The resource is packaged. we are unable to save the component with the correct namespace.

Explicit use of namespace "XYZ in file "ABC.js" is prohibited. Use default namespace "c" instead.",

2
  • 2
    What are you trying to do with this component? It's not clear from what you've provided.
    – sfdcfox
    Jun 29 '20 at 4:30
  • 1
    Can you share code how you are using your lwc component? As per error it shows that you should use c-abc instead of xyz-abc Jun 29 '20 at 6:40
0

I have seen such issues in the past for example when I change c to another prefix (import { reduceErrors } from "UP2GO_CPRM_BM/ldsutils"), I get the following error:

Error:(1, 1) LWC1504: Invalid module id "UP2GO_CPRM_BM/ldsutils" for type "module". Explicit use of namespace "UP2GO_CPRM_BM" in file "processChart.js" is prohibited. Use default namespace "c" instead.

Here is the right way of doing it if you are not already doing in your code

=================
// example.js
import { LightningElement, track } from 'lwc';

// same namespace
import { MyNamedExport } from 'c/commonUtils';
import MyDefaultExport from 'c/commonUtils';

// another namespace
import { TheirNamedExport } from 'acme/commonUtils';
import TheirDefaultExport from 'acme/commonUtils';

export default class Example extends LightningElement {

}

We should always code with the default namespace, c regardless of where the code is running: in an org with or without a namespace. See Component Namespaces

If you continue experiencing the issue, I suggest creating a support case. There are some relevant Known Issues around this behavior

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.