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