Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storybook of component to using lwc component #23

Open
jserra91 opened this issue May 26, 2021 · 1 comment
Open

Storybook of component to using lwc component #23

jserra91 opened this issue May 26, 2021 · 1 comment

Comments

@jserra91
Copy link

jserra91 commented May 26, 2021

I created a custom component that contains a lightning component.

<template> <button type="button" class="slds-button slds-button_icon atom-icon-button"> <template if:true={iconLeft}> <lightning-icon icon-name={iconLeft} alternative-text={iiconAlternativeText} title={iiconTitle} size={iiconSize}> </lightning-icon> </template> <span class="slds-assistive-text"></span> <template if:true={iconRight}> <lightning-icon icon-name={iconRight} alternative-text={iiconAlternativeText} title={iiconTitle} size={iiconSize}> </lightning-icon> </template> </button> </template>

When I implement the storybook for this component

import { storiesOf } from '@storybook/html';
import AtomIconButton from './atomIconButton';
import buildAndRegisterCustomElement from '../../utils/build-custom-element';

buildAndRegisterCustomElement('c-atom-icon-button', AtomIconButton);

The console return this error

ERROR in ./force-app/main/default/lwc/atomIconButton/atomIconButton.html
Module not found: Error: Can't resolve 'lightning/icon' in 'C:\vrmobility\work\valueRetailDev\force-app\main\default\lwc\atomIconButton'

Have you ever tried to put an LWC component in a separate project? That is, having a component dependency.

@reiniergs @dianawidjaja

@garkey
Copy link

garkey commented Jun 29, 2021

@jserra91 I was able to resolve dependencies by adding them as aliases in lwc.config.json. It's a more manual process than preferred, but it's a solution.

      {
        "name": "c/primitiveIcon",
        "path": "src/lwc/primitiveIcon/primitiveIcon.js"
      },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants