error: undefined function (there is no such import) nofile:1
briankariuki opened this issue · 2 comments
briankariuki commented
I keep getting this error at times when I import components into a storybook. For example,
defmodule Storybook.UI.Tab do
use PhoenixStorybook.Story, :component
alias Elixir.TremorxWeb.CoreComponents
def function, do: &Tremorx.Components.Tab.tabs/1
def imports,
do: [
{CoreComponents, icon: 1},
{Tremorx.Components.Layout, [flex: 1, card: 1, col: 1, grid: 1]},
{Tremorx.Components.Text, [metric: 1, text: 1]}
]
end
The page fails to compile with the error below. I already have the functional components inside of my module which lives in another app in the same umbrella project as well as my storybook app.
error: undefined function card/1 (there is no such import) nofile:1
Importing the components one by one works
def imports,
do: [
{CoreComponents, icon: 1},
{Tremorx.Components.Layout, [flex: 1, grid: 1]},
{Tremorx.Components.Layout, card: 1},
{Tremorx.Components.Layout, col: 1},
{Tremorx.Components.Bar, progress_bar: 1},
{Tremorx.Components.Text, [metric: 1, text: 1]}
]
deps
{:phoenix, "~> 1.7.10"},
{:phoenix_html, "~> 3.3"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
{:phoenix_live_view, "~> 0.20"},
{:phoenix_storybook, "~> 0.5.0"},
shirishgoyal commented
https://hexdocs.pm/phoenix_storybook/components.html#aliases-imports
Ideal way to write as per above doc is as below
[{Tremorx.Components.Layout, flex: 1}, {Tremorx.Components.Layout, card: 1}, {Tremorx.Components.Layout, col: 1}]
cblavier commented
Hey @briankariuki, thanks for the report, it seems to be a bug.
I'll try to get it fixed this week