@galacean/engine-loader 2.0.0-alpha.39 → 2.0.0-alpha.41

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/dist/main.js CHANGED
@@ -6396,19 +6396,15 @@ var ShaderLoader = /*#__PURE__*/ function(Loader) {
6396
6396
  var _proto = ShaderLoader.prototype;
6397
6397
  _proto.load = function load(item, resourceManager) {
6398
6398
  var url = item.url;
6399
- if (url.endsWith(".shaderc")) {
6400
- // @ts-ignore
6401
- return resourceManager._request(url, _extends({}, item, {
6402
- type: "json"
6403
- })).then(function(data) {
6404
- // @ts-ignore - _createFromPrecompiled is @internal
6405
- return engineCore.Shader._createFromPrecompiled(data);
6406
- });
6407
- }
6408
- // @ts-ignore
6399
+ // @ts-expect-error _request is @internal
6409
6400
  return resourceManager._request(url, _extends({}, item, {
6410
6401
  type: "text"
6411
6402
  })).then(function(code) {
6403
+ var source = code.trimStart();
6404
+ if (source.startsWith("{")) {
6405
+ // @ts-expect-error _createFromPrecompiled is @internal
6406
+ return engineCore.Shader._createFromPrecompiled(JSON.parse(source));
6407
+ }
6412
6408
  return engineCore.Shader.create(code, undefined, url);
6413
6409
  });
6414
6410
  };