@modul-es/icons 0.1.3 → 0.1.5

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/dist/Icon.js +6 -3
  2. package/package.json +1 -1
package/dist/Icon.js CHANGED
@@ -57,7 +57,7 @@ function Icon(_a) {
57
57
  }, [name, set, style]);
58
58
  (0, react_1.useEffect)(function () {
59
59
  var loadSvg = function () { return __awaiter(_this, void 0, void 0, function () {
60
- var params, colorValue, url, response, svg, _a;
60
+ var params, colorValue, isDev, baseUrl, url, response, svg, _a;
61
61
  return __generator(this, function (_b) {
62
62
  switch (_b.label) {
63
63
  case 0:
@@ -72,8 +72,11 @@ function Icon(_a) {
72
72
  }
73
73
  if (stroke)
74
74
  params.set('stroke', stroke);
75
- url = "https://icons.modul.es/".concat(set, "/").concat(iconKey, ".svg").concat(params.toString() ? "?".concat(params.toString()) : '');
76
- return [4 /*yield*/, fetch(url, { mode: 'cors' })];
75
+ isDev = typeof window !== 'undefined' &&
76
+ (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1');
77
+ baseUrl = isDev ? '' : 'https://modul.es';
78
+ url = "".concat(baseUrl, "/api/icons/").concat(set, "/").concat(iconKey, ".svg").concat(params.toString() ? "?".concat(params.toString()) : '');
79
+ return [4 /*yield*/, fetch(url, isDev ? {} : { mode: 'cors' })];
77
80
  case 2:
78
81
  response = _b.sent();
79
82
  if (!response.ok) return [3 /*break*/, 4];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modul-es/icons",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Icon component system",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",