Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the name of the _nuxt folder?

Hello I've got an issue with a Nuxt.js app that I can't seem to resolve. What I want to do is to change the name of the generated _nuxt folder with some other name. So far I've updated the nuxt.config.js and added this snippet:

build: { publicPath: '/new-folder' },

as far as I understand this publicPath variable expects a CDN link so probably this is not the correct way of changing the default _nuxt folder name.

I have also tried adding the buildDir: 'new-folder but when I run the build command it doesn't show up in the project. No matter what changes I added in the nuxt.config file when I deployed it on heroku all the assets where still in the _nuxt folder which causes issues to my project. Am I not seeing something am I doing something wrong?

like image 882
captain Avatar asked Feb 24 '20 11:02

captain


People also ask

What is .nuxt folder?

The . nuxt folder is part of the files needed to deploy your SSR application. It is not needed for deploying your static Nuxt app though because we use the dist folder for that. Edit this page on GitHub Updated at Wed, Oct 26, 2022.

Does NUXT use Vue router?

Nuxt automatically generates the vue-router configuration for you, based on your provided Vue files inside the pages directory. That means you never have to write a router config again! Nuxt also gives you automatic code-splitting for all your routes.

What is SSR NUXT?

Server-side rendering (SSR), is the ability of an application to contribute by displaying the web-page on the server instead of rendering it in the browser. Server-side sends a fully rendered page to the client; the client's JavaScript bundle takes over which then allows the Vue. js app to hydrate .

What is NUXT PWA?

The Nuxt. js PWA module registers a service worker for you to deal with offline caching. It automatically generates a manifest.json file. It automatically adds SEO friendly meta data with manifest integration. It automatically generates app icons with different sizes.


2 Answers

Since the default answer in nuxt JS Documentation is /_nuxt/. The correct answer should be /yourCustomName/ - be ware that you need two forward slash.

In nuxt.config.js

build: {
  publicPath: '/customName/'
}
like image 53
Chris Yeung Avatar answered Oct 12 '22 14:10

Chris Yeung


t's simple, just change in build the publicPath. buildDir is to change the folder for development, where the files will be when coding

nuxt.config.js:

build: {
    publicPath: 'new-folder/',
},

in my case, my publicPath is leo/ enter image description here

you can check more about it here: https://medium.com/@andrejsabrickis/how-to-set-custom-configuration-for-nuxt-js-generate-task-5055e53c2da5

like image 35
Leonardo Cavalcante Avatar answered Oct 12 '22 13:10

Leonardo Cavalcante