@data-fair/dev-server 2.3.2 → 2.3.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@data-fair/dev-server",
3
- "version": "2.3.2",
3
+ "version": "2.3.4",
4
4
  "description": "A development server for optimal development experience of data-fair applications.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/app.js CHANGED
@@ -179,6 +179,15 @@ app.get('/configurations/:id', async (req, res) => {
179
179
  res.status(500).send({ error: err.message });
180
180
  }
181
181
  });
182
+ // the vite dev server of the app under development rewrites the root-relative URLs of
183
+ // index.html under the app base, so the /simple-directory/... links (_theme.css, _public.js)
184
+ // come back as <base>/simple-directory/... and would 404 on the app proxy below ;
185
+ // send them back to the /simple-directory proxy instead
186
+ if (appPrefix) {
187
+ app.use(appPrefix + '/simple-directory', (req, res) => {
188
+ res.redirect(307, '/simple-directory' + req.url);
189
+ });
190
+ }
182
191
  // re-expose the application performing similar modifications to the body as data-fair
183
192
  app.use('/app', createProxyMiddleware({
184
193
  target: appUrl.origin,
@@ -325,7 +334,7 @@ app.use('/data-fair', createProxyMiddleware({
325
334
  let body = '';
326
335
  proxyRes.on('data', (data) => { body += data.toString(); });
327
336
  proxyRes.on('end', () => {
328
- const output = body.replace(new RegExp(escapeStringRegexp(config.dataFair.url), 'g'), 'http://localhost:5888/data-fair');
337
+ const output = body.replace(new RegExp(escapeStringRegexp(config.dataFair.url), 'g'), `http://localhost:${config.port}/data-fair`);
329
338
  // proxyRes.headers['content-length'] = output.length
330
339
  delete proxyRes.headers['content-length'];
331
340
  res.writeHead(proxyRes.statusCode ?? 200, proxyRes.headers);
package/src/index.js CHANGED
File without changes