小编use*_*912的帖子

Jhipster:如何为 prod webpack 配置文件覆盖 SERVER_API_URL

我知道 SERVER_API_URL 是在 webpack-common.js 中定义的,默认情况下为空。但是在生产中,我需要不同的 api URL,我在 webpack-prod.js 的“plugins”数组中做了以下添加,但没有看到任何效果。我相信它必须与 webpack-merge 相关,现在它可以与 DefinePlugin 一起使用。我试图阅读 webpack-merge 的文档,但看起来需要大量阅读。

        new webpack.DefinePlugin({
        'process.env': {
            // The root URL for API calls, ending with a '/' - for example: `"http://www.jhipster.tech:8081/myservice/"`.
            // If this URL is left empty (""), then it will be relative to the current context.
            // If you use an API server, in `prod` mode, you will need to enable CORS
            // (see the `jhipster.cors` common JHipster property in the `application-*.yml` configurations)
            SERVER_API_URL: '"http://172.26.0.150:9000/"' …
Run Code Online (Sandbox Code Playgroud)

jhipster webpack webpack-2

5
推荐指数
1
解决办法
895
查看次数

标签 统计

jhipster ×1

webpack ×1

webpack-2 ×1