@ixon-cdk/core 1.2.0-next.7 → 1.2.0-next.8

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/server/index.js +12 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ixon-cdk/core",
3
- "version": "1.2.0-next.7",
3
+ "version": "1.2.0-next.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "",
package/server/index.js CHANGED
@@ -62,7 +62,18 @@ module.exports = class Server {
62
62
  );
63
63
 
64
64
  // Simulator app
65
- const appDir = path.dirname(require.resolve('@ixon-cdk/simulator'));
65
+ let appDir;
66
+ try {
67
+ appDir = path.dirname(require.resolve('@ixon-cdk/simulator'));
68
+ } catch (e) {
69
+ // If require.resolve is invoked immediately after the simulator is installed, it will return
70
+ // a "MODULE_NOT_FOUND" error. In that case (as a fallback) we'll find the simulator app dir
71
+ // relative to the core module (which should have already been installed).
72
+ appDir = path.join(
73
+ require.resolve('@ixon-cdk/core'),
74
+ '../../simulator/dist',
75
+ );
76
+ }
66
77
  app.get(`/${this._opts.componentBasePath}/*`, (req, res) => {
67
78
  res.sendStatus(404);
68
79
  });