spa-ssi 0.0.14 → 0.0.15

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 (2) hide show
  1. package/package.json +1 -1
  2. package/serve.js +4 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spa-ssi",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "description": "Single Page App / Server Side Include Simple File Web Server",
5
5
  "keywords": [
6
6
  "single-page-app",
package/serve.js CHANGED
@@ -293,9 +293,9 @@ class SimpleHTTPRequestHandler {
293
293
  const includeString = match[1];
294
294
  if(includeString.endsWith('.mjs')){
295
295
  // Dynamic import
296
- const resolvedFilePath = path.join(process.cwd(), includeString);
297
- console.log(`Including JS module: ${resolvedFilePath}`);
298
- const test = await import(`./${resolvedFilePath}`);
296
+ //const resolvedFilePath = path.join(process.cwd(), includeString);
297
+ //console.log(`Including JS module: ${resolvedFilePath}`);
298
+ const test = await import(includeString);
299
299
  if(test.render && typeof test.render === 'function'){
300
300
  const renderedContent = test.render();
301
301
  html = html.replace(match[0], renderedContent);
@@ -361,6 +361,7 @@ const types = {
361
361
  ".html": "text/html",
362
362
  ".css": "text/css",
363
363
  ".js": "application/javascript",
364
+ ".mjs": "application/javascript",
364
365
  ".json": "application/json",
365
366
  ".png": "image/png",
366
367
  ".jpg": "image/jpeg",