#URI Malformed & plugin:nuxt:pages-macros-transform issues upgrading from RC.11

11 messages · Page 1 of 1 (latest)

pearl fern
#

I have an app that is working perfectly on RC.11, and I'm having a hard time figuring out why Nuxt is so mad at me when trying to upgrade to 3.0.0.

When the app is building in dev mode, I get a ERROR URI malformed message logged, but then Vite and Nitro continue to build and serve the app. When I go to the URL of the app, I get [vite-node] [plugin:nuxt:pages-macros-transform] [VITE_ERROR] /pages/index.vue?macro=true. I've gone through the effort of commenting things out to try and figure out where the pain point is, and I'm to the point where my app file doesn't even have a <NuxtLayout> or <NuxtPage> component, just says "SERIOUSLY???". I've updated my server routes to use readBody() instead of useBody() with the h3 updates. As a last ditch attempt on the server side, I made all routes return "Hi". I've also updated my alias in config to be "%": fileURLToPath(new URL('../shared', import.meta.url)) to match the pattern in the documentation, just to see if there was an issue accessing some of the shared components in my project.

One piece to potentially note, I am using a yarn workspace to manage packages (has worked up to now), so I also have modulesDir: ["../node_modules"], in my config.

I've been banging my head against this issue for days at this point, and I would appreciate it if anyone could point me in the right direction.

#

More context, if I try to build and start instead of dev -o, i get the following

ERROR  [nuxt:pages-macros-transform] URI malformed
file: /app/site-com/pages/index.vue?macro=true


 ERROR  URI malformed

  at decodeURIComponent (<anonymous>)
  at parseMacroQuery (/app/node_modules/nuxt/dist/index.mjs:380:31)
  at /app/node_modules/nuxt/dist/index.mjs:286:48
  at Array.find (<anonymous>)
  at Object.transform (/app/node_modules/nuxt/dist/index.mjs:286:36)
  at Object.plugin.transform (/app/node_modules/unplugin/dist/index.mjs:1179:25)
  at /app/node_modules/rollup/dist/es/shared/rollup.js:22748:40
fair dome
#

That sounds like strange errors. Have you tried to completely delete the node_modules, .nuxt and package-lock.json/yarn.lock, .output and dist folders?

So basically trying to re-generate everything.

Maybe you can show how the index.vue looks like.

pearl fern
#

Alright, I've fully deleted node_modules, yarn.lock, and cleared the nuxt build directories, ran a yarn install --no-cache to make sure I wasn't grabbing anything from local, and I'm getting the same error.

My Nuxt Config currently is:

import { fileURLToPath } from "url"

// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
    alias: {
        "%": fileURLToPath(new URL('../shared', import.meta.url))
    },
    modulesDir: ["../node_modules"],
    runtimeConfig: {***}
    },
    vite: {
        server: {
            hmr: {
                host: "site.com.localhost",
                port: 3000,
                clientPort: 443
            },
            watch: {
                usePolling: true
            }
        }
    }
})

My app.vue file is down to just this uncommented:

<script setup>
</script>

<template>
    <div>
        Dude, SERIOUSLY???
    </div>
</template>

My index.vue file is down to just this uncommented:

<script setup>
</script>

<template>
    <div>
        HELLO??????
    </div>
</template>
#

Granted, I have a lot more pages... but I was hoping that I didn't have to go through each one, comment everything out, and work backwards if there was a quick fix

#

The whole app works flawlessly in RC.11

fair dome
#

Thanks for the details, yeah that is interesting. I never worked with the alias option, so maybe someone can jump in to share details about that. Since I don't see any other issue.

I could imagine it is causing an issue because its the % symbol, and its colliding with some internal alias. I would try to change that.

#

So maybe either changing or temporarly removing the alias and importing the things you imported without manually.

pearl fern
#

I'll give that a try a little later this evening!

pearl fern
#

Dude, you're an absolute legend! You were 100% right, for some reason the % was suddenly breaking it's ability to compile the URI. Swapped it out for a shared alias and BOOM works!

Thank you so much!

fair dome
#

@pearl fern Amazing to hear!!