@xh/hoist-dev-utils 12.0.0-SNAPSHOT.1774909008634 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -61,7 +61,7 @@ try {
61
61
  * @param {Object} [env.resolveAliases] - object mapping for custom webpack module resolution.
62
62
  * When inlineHoist=true, a mapping between @xh/hoist and the local path will be added.
63
63
  * @param {string} [env.baseUrl] - root path prepended to all relative URLs called via FetchService. Defaults to
64
- * `/api/` in production mode to work with proxy-based deployments and to `$devHost:$devGrailsPort` in dev mode.
64
+ * `/api/`, a root path that will cause the request to be proxied to the Grails backend at `devHost:devGrailsPort`.
65
65
  * @param {string[]} [env.babelIncludePaths] - additional paths to pass Babel for transpiling via settings shared with
66
66
  * app-level and @xh/hoist code. Intended for custom packages.
67
67
  * @param {string[]} [env.babelExcludePaths] - paths to exclude from Babel transpiling. An example use would be a local
@@ -127,7 +127,7 @@ async function configureWebpack(env) {
127
127
  devGrailsPort = env.devGrailsPort || 8080,
128
128
  devWebpackPort = env.devWebpackPort || 3000,
129
129
  devServerOptions = env.devServerOptions || {},
130
- baseUrl = env.baseUrl || (prodBuild ? '/api/' : `//${devHost}:${devGrailsPort}/`),
130
+ baseUrl = env.baseUrl || '/api/',
131
131
  babelIncludePaths = env.babelIncludePaths || [],
132
132
  babelExcludePaths = env.babelExcludePaths || [],
133
133
  contextRoot = env.contextRoot || '/',
@@ -738,6 +738,21 @@ async function configureWebpack(env) {
738
738
  };
739
739
  })
740
740
  },
741
+ // Proxy API requests to the Grails backend, mirroring the production nginx setup.
742
+ // Only needed when baseUrl is a relative path (default '/api/') — if baseUrl is
743
+ // an absolute URL, the app will call the remote server directly.
744
+ proxy: baseUrl.startsWith('/')
745
+ ? [
746
+ {
747
+ context: baseUrl.slice(0, -1),
748
+ target: `http://${devHost}:${devGrailsPort}`,
749
+ pathRewrite: {[`^${baseUrl.slice(0, -1)}`]: ''},
750
+ changeOrigin: true,
751
+ secure: false,
752
+ ws: true
753
+ }
754
+ ]
755
+ : [],
741
756
  ...devServerOptions
742
757
  }
743
758
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist-dev-utils",
3
- "version": "12.0.0-SNAPSHOT.1774909008634",
3
+ "version": "12.0.0",
4
4
  "description": "Utilities for configuring builds of Hoist-React client applications.",
5
5
  "repository": {
6
6
  "type": "git",