relative path in @nuxtjs/dotenv

馋奶兔 提交于 2021-01-29 16:32:06

问题


I am building an SSR nuxt.js project with laravel backend, and I want to share the .env for both laravel and nuxt.

Here is my folder structure (base on a laravel folder structure but add a client folder to put nuxt)

here is my nuxt.config.js

module.exports = {
    srcDir: __dirname,
    buildModules: [
        [
            '@nuxtjs/dotenv',
            {
                path: '../'
            }
        ]
    ]
}

package.json

{
    "private": true,
    "scripts": {
        "dev": "node_modules/nuxt/bin/nuxt.js -c client/nuxt.config.js",
        "build": "node_modules/nuxt/bin/nuxt.js build -c client/nuxt.config.js",
        "start": "node_modules/nuxt/bin/nuxt.js start -c client/nuxt.config.js",
        "lint": "eslint --fix --ext .js,.vue client/",
        "prod": "npm run build && npm run start"
    },
    "config": {
        "nuxt": {
            "host": "0.0.0.0",
            "port": "3000"
        }
    },
    "dependencies": {
        "@nuxtjs/dotenv": "^1.4.1",
        "nuxt": "^2.12.2",
    }
}

I want to use a relative path instead of an absolute path, but it doesn't work.

How can I fix it? Thanks a lot (^_^)

来源:https://stackoverflow.com/questions/61337535/relative-path-in-nuxtjs-dotenv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!