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

Full static payload.js not using publicPath #7923

Closed
scferg opened this issue Aug 15, 2020 · 7 comments · Fixed by #8344
Closed

Full static payload.js not using publicPath #7923

scferg opened this issue Aug 15, 2020 · 7 comments · Fixed by #8344

Comments

@scferg
Copy link

scferg commented Aug 15, 2020

Versions

  • nuxt: 2.14.1
  • node: 6.4.1

Reproduction

nuxt.config.js below in Additional Details.

Additional Details
export default {
  /*
  ** Nuxt rendering mode
  ** See https://nuxtjs.org/api/configuration-mode
  */
  mode: 'universal',
  /*
  ** Nuxt target
  ** See https://nuxtjs.org/api/configuration-target
  */
  target: 'static',
  /*
  ** Headers of the page
  ** See https://nuxtjs.org/api/configuration-head
  */
  head: {
    title: process.env.npm_package_name || '',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
      { rel: 'stylesheet', href: 'https://use.typekit.net/tzk2btd.css' }
    ],
    script: [
      { src: 'https://unpkg.com/ionicons@5.1.2/dist/ionicons.js', body: true }
    ]
  },
  /*
  ** Global CSS
  */
  css: [
    '~/assets/styles/main.scss'
  ],
  styleResources: {
    scss: [
      '~/assets/styles/_variables.scss',
      'bootstrap/scss/_functions.scss',
      'bootstrap/scss/_variables.scss',
      'bootstrap/scss/_mixins.scss',
    ]
  },
  /*
  ** Plugins to load before mounting the App
  ** https://nuxtjs.org/guide/plugins
  */
  plugins: [
  ],
  /*
  ** Auto import components
  ** See https://nuxtjs.org/api/configuration-components
  */
  components: true,
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [
    '@nuxtjs/style-resources',
  ],
  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://bootstrap-vue.js.org
    'bootstrap-vue/nuxt',
  ],
  /*
  ** Build configuration
  ** See https://nuxtjs.org/api/configuration-build/
  */
  build: {
    publicPath: 'https://khn.s3.us-east-1.amazonaws.com/virtual-series/'
  },
  generate: {
    subFolders: false
  },
  vue: {
    config: {
      ignoredElements: [/^ion-/]
    }
  },
  bootstrapVue: {
    bootstrapCSS: false,
    bootstrapVueCSS: false
  },
}

Steps to reproduce

  1. Specify a publicPath in nuxt.config.js for a full static app
  2. Run nuxt generate
  3. Deploy /dist/ directory to static hosting (S3 in this case)
  4. Visit static page and view console for incorrect URL errors for the payload.js file

What is Expected?

I would expect the payload.js file to also use the specified publicPath instead of using a relative path. I added a publicPath specifically because I need absolute paths for everything.

What is actually happening?

The payload.js files are being linked using relative paths. Bootstrap Vue actions (such as opening modals) are not functioning when deployed. I'm guessing it's related to this.

  • runtime.js (correct): https://khn.s3.us-east-1.amazonaws.com/virtual-series/runtime.ad4e919.js
  • payload.js (incorrect): /static/1597456812/<page-filename>/payload.js

All other assets are using the publicPath as expected. Am I missing something?

@asafyish
Copy link

I can confirm it's also not working for me. Every other resource does use the publicPath correctly.

@jackframework
Copy link

It's not working for me too.

@Grugier
Copy link

Grugier commented Sep 4, 2020

Same problem

@paullegrand
Copy link

+1, same problem

@stale
Copy link

stale bot commented Nov 6, 2020

Thanks for your contribution to Nuxt.js!
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 Nov 6, 2020
@r14c
Copy link

r14c commented Nov 13, 2020

we are seeing this issue in nuxt@2.14.6.

@nathancall there's a patch release version of nuxt that might be worth trying to see if it resolves this issue. otherwise we might need to open a PR and patch nuxt ourselves.

@pi0
Copy link
Member

pi0 commented Dec 1, 2020

This should be fixed in v2.14.8. Please reopen if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants