@udixio/theme 1.0.0-beta.29 → 1.0.0-beta.30

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": "@udixio/theme",
3
- "version": "1.0.0-beta.29",
3
+ "version": "1.0.0-beta.30",
4
4
  "license": "MIT",
5
5
  "author": "vigreux-joël",
6
6
  "exports": {
@@ -63,29 +63,39 @@ export class ConfigService {
63
63
  }
64
64
 
65
65
  private getConfig(): ConfigInterface {
66
- const base = resolve(this.configPath);
67
- const extensions = ['.js', '.ts', '.jms', '.jcs'];
68
- let configImport = null;
66
+ if (
67
+ typeof process !== 'undefined' &&
68
+ process.release &&
69
+ process.release.name === 'node'
70
+ ) {
71
+ const base = resolve(this.configPath);
72
+ const extensions = ['.js', '.ts', '.jms', '.jcs'];
73
+ let configImport = null;
69
74
 
70
- for (const ext of extensions) {
71
- const path = base + ext;
72
- if (existsSync(path)) {
73
- configImport = require(path);
74
- break;
75
+ for (const ext of extensions) {
76
+ const path = base + ext;
77
+ if (existsSync(path)) {
78
+ configImport = require(path);
79
+ break;
80
+ }
75
81
  }
76
- }
77
82
 
78
- if (!configImport) {
79
- throw new Error('Configuration file not found');
80
- }
83
+ if (!configImport) {
84
+ throw new Error('Configuration file not found');
85
+ }
81
86
 
82
- let config: unknown;
83
- if ('default' in configImport) {
84
- config = configImport.default;
87
+ let config: unknown;
88
+ if ('default' in configImport) {
89
+ config = configImport.default;
90
+ } else {
91
+ config = configImport;
92
+ }
93
+
94
+ return config as ConfigInterface;
85
95
  } else {
86
- config = configImport;
96
+ throw new Error(
97
+ 'You must provide configuration object when using this library in a browser.'
98
+ );
87
99
  }
88
-
89
- return config as ConfigInterface;
90
100
  }
91
101
  }