Recientemente comencé un proyecto con Nuxt js. Pero debido a que la empresa usa el mismo servidor con otra aplicación, y la ruta URL https://my-company.com/_nuxt/ URL ya utilizada por otra aplicación, tengo que agregar /customprefix/ a la ruta de la aplicación. Entonces, la URL de ruta esperada es https://my-company.com/customprefix/_nuxt/ .
Ya intenté agregar publicPath como se menciona en la respuesta aceptada de esta pregunta y también crear una carpeta llamada customprefix en la raíz de la aplicación, pero los archivos aún se generan en https://my-company.com/_nuxt/
Aquí está mi archivo nuxt.config.js actual
export default { // Global page headers: https://go.nuxtjs.dev/config-head build:{ publicPath: "/customprefix" }, static:{ prefix: true }, head: { titleTemplate: '%s - nuxt-test', title: 'nuxt-test', htmlAttrs: { lang: 'en' }, meta: [ { charset: 'utf-8' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' }, { hid: 'description', name: 'description', content: '' }, { name: 'format-detection', content: 'telephone=no' } ], link: [ { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } ] }, // Global CSS: https://go.nuxtjs.dev/config-css css: [ ], // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins plugins: [ ], // Auto import components: https://go.nuxtjs.dev/config-components components: true, // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules buildModules: [ // https://go.nuxtjs.dev/vuetify '@nuxtjs/vuetify', ], // Modules: https://go.nuxtjs.dev/config-modules modules: [ ], // Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify vuetify: { customVariables: ['~/assets/variables.scss'], theme: { dark: true, themes: { dark: { primary: colors.blue.darken2, accent: colors.grey.darken3, secondary: colors.amber.darken3, info: colors.teal.lighten1, warning: colors.amber.base, error: colors.deepOrange.accent4, success: colors.green.accent3 } } } }, // Build Configuration: https://go.nuxtjs.dev/config-build build: { } }Se agradece mucho cualquier ayuda.
Acabo de encontrar la solución. Resulta que lo que necesito hacer es configurar la propiedad base en el enrutador .
Mi archivo final nuxt.config.js :
import colors from 'vuetify/es5/util/colors' export default { // Global page headers: https://go.nuxtjs.dev/config-head router:{ base:"/customprefix/" }, static:{ prefix: true }, head: { titleTemplate: '%s - nuxt-test', title: 'nuxt-test', htmlAttrs: { lang: 'en' }, meta: [ { charset: 'utf-8' }, { name: 'viewport', content: 'width=device-width, initial-scale=1' }, { hid: 'description', name: 'description', content: '' }, { name: 'format-detection', content: 'telephone=no' } ], link: [ { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } ] }, // Global CSS: https://go.nuxtjs.dev/config-css css: [ ], // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins plugins: [ ], // Auto import components: https://go.nuxtjs.dev/config-components components: true, // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules buildModules: [ // https://go.nuxtjs.dev/vuetify '@nuxtjs/vuetify', ], // Modules: https://go.nuxtjs.dev/config-modules modules: [ ], // Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify vuetify: { customVariables: ['~/assets/variables.scss'], theme: { dark: true, themes: { dark: { primary: colors.blue.darken2, accent: colors.grey.darken3, secondary: colors.amber.darken3, info: colors.teal.lighten1, warning: colors.amber.base, error: colors.deepOrange.accent4, success: colors.green.accent3 } } } }, // Build Configuration: https://go.nuxtjs.dev/config-build build: { } }Lo que agrego es:
router:{ base:"/customprefix/" },Podrías probar esto
build: { publicPath: '/your-customprefix/' },