NuxtJS runtimeConfig to be save to a single js file on build?

250 views Asked by At

In my nuxt.config.js, I'm using runtimeConfig:

export default {
  ssr: false,
  target: 'static',
  publicRuntimeConfig: {
    baseURL: process.env.BASE_URL,
    apiURL: process.env.API_URL,
    emailAddress: process.env.EMAIL_ADDRESS,
    wafURL: process.env.WAF_URL,
    appBuildYYYY: new Date().getFullYear(),
    appVersion: process.env.npm_package_version,
    appName: process.env.npm_package_name,
    appHomepage: process.env.npm_package_homepage
  }

When I npx nuxt build and look in my /dist folder, the resulting runtime configs are saved in the individual HTML pages (/pageName/index.html) inside a <script>.

Is there a way to build it where it becomes centrally stored? Like in a /dist/_nuxt/runtimeConfig.js?

0

There are 0 answers