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

createNext method ignores runtime basePath property #9625

Open
reinisp opened this issue Aug 3, 2021 · 3 comments
Open

createNext method ignores runtime basePath property #9625

reinisp opened this issue Aug 3, 2021 · 3 comments

Comments

@reinisp
Copy link

reinisp commented Aug 3, 2021

Versions

  • nuxt: v2.15.7
  • node: v14.17.3

Reproduction

Additional Details
  const $config = ssrContext.runtimeConfig || {}
  const routerBase = ($config._app && $config._app.basePath) || '<%= router.base %>'

snippet from https://github.com/nuxt/nuxt.js/blob/dev/packages/vue-app/template/server.js#L62 always fallback to '<%= router.base %>' as $config._app is always undefined.
It could be accessed either from $config.public._app.basePath or $config.private._app.basePath

Steps to reproduce

What is Expected?

When using redirect('/some-path') on server side it reads basePath property from runtimeConfig if exists

What is actually happening?

When using redirect('/some-path') on server side it always prepends route.base property defined un build

@reinisp
Copy link
Author

reinisp commented Aug 3, 2021

Current workaround by adding hook:

    'vue-renderer:ssr:prepareContext': (ssrContext) => {
      const { runtimeConfig } = ssrContext;

      if (runtimeConfig && !runtimeConfig._app && runtimeConfig.public?._app) {
        runtimeConfig._app = runtimeConfig.public._app;
      }
    },

Copy link
Member

Atinux commented Aug 3, 2021

Thank you for your bug report. Do you mind opening a PR please?

@stale
Copy link

stale bot commented Apr 27, 2022

Thanks for your contribution to Nuxt!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of nuxt-edge
  2. Comment the steps to reproduce it

Issues that are labeled as pending will not be automatically marked as stale.

@stale stale bot added the stale label Apr 27, 2022
@danielroe danielroe added the 2.x label Jan 18, 2023
@stale stale bot removed the stale label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants