@boomerang-io/webapp-spa-server 1.1.0-beta.1 → 1.2.0-beta.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.
Files changed (3) hide show
  1. package/index.js +6 -4
  2. package/package.json +1 -1
  3. package/tester.js +0 -0
package/index.js CHANGED
@@ -87,15 +87,17 @@ function createBoomerangServer({
87
87
  * Do NOT return index.html file by default if `disableInjectHTMLHeadData = true`. We need append data to it.
88
88
  * It will be returned on the second route
89
89
  * https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#serving-apps-with-client-side-routing
90
+ * Cache assets "forever" aka max recommended value of one year
90
91
  */
91
92
  if (!disableInjectHTMLHeadData) {
92
93
  appRouter.use(
93
94
  "/",
94
95
  express.static(path.join(process.cwd(), BUILD_DIR), {
96
+ maxAge: 31536000,
95
97
  index: false,
96
98
  })
97
99
  );
98
- appRouter.get("/*", (req, res) =>
100
+ appRouter.get("/*", (_, res) =>
99
101
  injectEnvDataAndScriptsIntoHTML({
100
102
  res,
101
103
  appRoot: APP_ROOT,
@@ -145,7 +147,7 @@ function injectEnvDataAndScriptsIntoHTML({ res, buildDir, appRoot, injectedDataK
145
147
  const localScriptTags = injectedScripts
146
148
  ? injectedScripts
147
149
  .split(",")
148
- .reduce((acc, currentValue) => `${acc}<script src="${appRoot}/${currentValue}"></script>`, "")
150
+ .reduce((acc, currentValue) => `${acc}<script async src="${appRoot}/${currentValue}"></script>`, "")
149
151
  : "";
150
152
  // Set the response type so browser interprets it as an html file
151
153
  res.type(".html");
@@ -219,7 +221,7 @@ function getGAScripts() {
219
221
  }
220
222
  };
221
223
  </script>
222
- <script src="https://1.www.s81c.com/common/stats/ibm-common.js" type="text/javascript" crossorigin></script>`
224
+ <script async src="https://1.www.s81c.com/common/stats/ibm-common.js" type="text/javascript" crossorigin></script>`
223
225
  : "";
224
226
  }
225
227
 
@@ -236,7 +238,7 @@ function getInstanaScripts() {
236
238
  ineum('key', '${instanaKey}');
237
239
  ineum('trackSessions');
238
240
  </script>
239
- <script defer crossorigin="anonymous" src="https://eum.instana.io/eum.min.js"></script>`
241
+ <script async crossorigin="anonymous" src="https://eum.instana.io/eum.min.js"></script>`
240
242
  : "";
241
243
  }
242
244
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@boomerang-io/webapp-spa-server",
3
3
  "description": "Webapp Server for React-based SPA w/ client-side routing",
4
- "version": "1.1.0-beta.1",
4
+ "version": "1.2.0-beta.0",
5
5
  "author": {
6
6
  "name": "Tim Bula",
7
7
  "email": "timrbula@gmail.com"
package/tester.js CHANGED
File without changes