3

I'm trying to load a static resource file in lightning web component which is running under vlocity_ins runtime. I'm getting the error Scoped imports are not allowed when runtime namespace is specified

import OmniscriptSelect from 'vlocity_ins/omniscriptSelect';
import template from './bhExtendedOmniscriptSelect.html';
import { loadStyle } from 'lightning/platformResourceLoader';
import newportoverride from '@salesforce/resourceUrl/newportoverride';

export default class BhExtendedOmniscriptSelect extends OmniscriptSelect {
    
    connectedCallback() {
        super.connectedCallback();
        this._realtimeOptions = this._realtimeOptions.filter(item => item.label !== '-- Clear --');

        Promise.all[(
            loadStyle(this, newportoverride + '/newport-override.css')
        )].then(() => {
            console.log('styles loaded');
        })
    }

    render() {
        return template;
    }
}

Below image shows error in omniscript when previewed on LWC preview tab Image shows the error in detail

1 Answer 1

3

This is now supported with Lightning Web Security. Check the documentation here. It's in Open BETA as of March 2022.

Previous Answer (Outdated)

Importing LWC component or static resource from another namespace is currently not supported as of today.

The locker service prevents this today. There is work in progress to support this in the future with safe harbor

There is an idea in the below link

https://trailblazer.salesforce.com/ideaView?id=0873A000000CaKLQA0

There is also a comment from PM on this on the below answer

Not being able to reference packaged custom LWCs from other LWCs outside the package

The alternative is to work with aura component or iframe VF page inside LWC

3
  • Is there a work around for this? Apr 1, 2021 at 4:36
  • Try Aura component instead! Apr 1, 2021 at 4:40
  • Will try this. Thanks @Mohith Apr 1, 2021 at 4:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .