Import custom vue file if exist or import default vue file

Hi everyone,

In my app, someone can add custom vue file. In this situation, when building app webpack must prefer custom file. (Maybe custom file doesnt exist)

According to this, i need to correct coding. But I couldnt achieve. Is anyone have an idea?

I tried this solution…

You might be able to do something using a require.context.

See this example in the Vue 2 docs. It’s trying to achieve something a bit different but it uses require.context to load whatever components happen to exist, which is roughly the same idea.