LinusBorg / portal-vue

A feature-rich Portal Plugin for Vue 3, for rendering DOM outside of a component, anywhere in your app or the entire document. (Vue 2 version: v2.portal-vue.linusb.org)
http://portal-vue.linusb.org
MIT License
3.89k stars 188 forks source link

router-link doesn't render when in production #361

Closed jwoertink closed 1 year ago

jwoertink commented 2 years ago

Yeah... it's a weird edge case. Maybe related to https://github.com/LinusBorg/portal-vue/issues/289 ?

Basically, I have this:

<portal to="subNavigation">
  <div class="sub-navigation">
    <router-link :to="{ name: 'NewPost' }" class="button">
      Create New Post
    </router-link>
  </div>
</portal>

<portal-target name="subNavigation" slim />

When I run my yarn dev, everything is great. When I run my yarn prod, the router-link doesn't render... However, I can put a normal <button> in and it works fine in production.

For reference, here's my package.json build scripts:

"dev": "yarn run webpack --progress --hide-modules --color --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "NODE_ENV=production yarn run webpack --progress --hide-modules --color --config=node_modules/laravel-mix/setup/webpack.config.js"

I don't have a way to make a smaller example, but I can test anything you need. Let me know.

Thanks!

LinusBorg commented 2 years ago

Would be helpful to have a runnable example of that code that does reproduce the problem, I'll need to look at what is actually rendered.

jwoertink commented 2 years ago

I'll see if I can get a little sandbox example going.

jwoertink commented 2 years ago

oh, and to add to it, it seems that slim also has to be there 🤔 but removing slim also throws this unhelpful error:

TypeError: n is undefined
    render http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    render http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    Se http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    render http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    _render http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    a http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    get http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    fn http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    exports http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    $mount http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    $mount http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    init http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    d http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    d http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    C http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1
    d http://localhost:5000/js/main.js?id=50b0da5cc527ece8424d:1

I'm still doing more investigating to see if I can narrow it down a bit more.

LinusBorg commented 1 year ago

I'll close this as inactive. Can't do much without a way to reproduce the problem