Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
600 views
in Technique[技术] by (71.8m points)

vue.js - In NuxtJS How to configure different paths for publicPath, outputDir, and indexPath

I have situation when i deploy NuxtJS App for production that I need put files in different paths.

I used this configurations before in Vue App in vue.config.js and it’s works fine:

module.exports = {
    publicPath:'/assets/my_app/my_page/',
    outputDir: path.resolve('../my_app/public/my_page'),
    indexPath: path.resolve('../my_app/www/my_page.html'),
    devServer: {
        allowedHosts: ["my_site.com"],
        proxy: {
            '^/api': serverProxy,
            '^/assets': serverProxy,
            '^/files': serverProxy
        }
    }
};

How can do the same configurations in NuxtJS?

I tried this in nuxt.config.js but it not working:

build: {
    publicPath:'/assets/my_app/my_page/',
    // outputDir: path.resolve('../my_app/public/my_page'), 
  },
generate: {
    dir: path.resolve('../my_app/www/my_page.html'),
  },

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

there are different Dir properties that you can use in nuxt.config. I think buildDir ,rootDir or srcDir can help you. However, you can access vue configuration and use your old solution by : nuxt.config vue.config property


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...