Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connot resolve webpack bundle like no entry #68

Open
AILHC opened this issue Mar 22, 2024 · 1 comment · May be fixed by #50
Open

connot resolve webpack bundle like no entry #68

AILHC opened this issue Mar 22, 2024 · 1 comment · May be fixed by #50
Labels
bug Something isn't working webpack

Comments

@AILHC
Copy link

AILHC commented Mar 22, 2024

Describe the bug

connot resolve webpack bundle like no entry

Expected Behaviour

unpack this bundle

Code

(()=>{
var __webpack_modules__ = {...};
var __webpack_module_cache__ = {};
  function __webpack_require__(e) {
    var t = __webpack_module_cache__[e];
    if (t !== undefined) {
      return t.exports;
    }
    var i = __webpack_module_cache__[e] = {
      exports: {}
    };
    __webpack_modules__[e].call(i.exports, i, i.exports, __webpack_require__);
    return i.exports;
  }
  __webpack_require__.d = (e, t) => {
    for (var i in t) {
      if (__webpack_require__.o(t, i) && !__webpack_require__.o(e, i)) {
        Object.defineProperty(e, i, {
          enumerable: true,
          get: t[i]
        });
      }
    }
  };
  __webpack_require__.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t);
  __webpack_require__.r = e => {
    if (typeof Symbol != "undefined" && Symbol.toStringTag) {
      Object.defineProperty(e, Symbol.toStringTag, {
        value: "Module"
      });
    }
    Object.defineProperty(e, "__esModule", {
      value: true
    });
  };
  var __webpack_exports__ = {};
  (() => {
    "use strict";

    const e = __webpack_require__(9896);
    const t = __webpack_require__(1914);
    const i = __webpack_require__(1441);
    const n = __webpack_require__(4718);
    const s = __webpack_require__(3890);
    const a = __webpack_require__(6324);
    const r = __webpack_require__(5026);
    const o = __webpack_require__(2020);
    const l = __webpack_require__(2966);
    const h = __webpack_require__(2542);
    global.ShaderEditor = (0, e.createEditor)(class {
      constructor() {
        Editor.typeRegistry.addTypes(l.allTypes);
      }
      async onBeginPlay(e) {
        Editor.createAppMenu((0, o.createAppMenuTemplate)());
        Editor.setWindowTitle("Shader Blueprint");
        Editor.createHotkeyManager();
        await Editor.connectAssetDb();
        await Editor.connectShaderDb();
        let i = await gui.UIPackage.createWidget("~/ui/editor/MainView2.widget");
        this._mainView = i;
        i.name = "MainView";
        i.setSize(gui.GRoot.inst.width, gui.GRoot.inst.height);
        i.addRelation(gui.GRoot.inst, gui.RelationType.Size);
        gui.GRoot.inst.addChild(i);
        this._tabBar = new r.FileTabBar(i);
        this._tabBar.onTabSelected = (...e) => this.onTabSelected(...e);
        this._tabBar.onTabWillClose = (...e) => this.onTabWillClose(...e);
        this._tabBar.onTabSave = (...e) => this.onTabSave(...e);
        this.previewFrame = new s.WebIFrame();
        this.previewFrame.port.handle("materialPreviewReady", () => {
          this.previewFrame.ready = true;
          if (t.ScenePanel.ins) {
            t.ScenePanel.ins.autoBuild(0);
          }
        });
        this.previewFrame.load("preview.html");
        let n = i.getChild("panelManager", gui.Shape);
        Editor.createPanelManager({
          filePath: "shaderEditorLayout.json",
          layouts: {
            default: {
              mainPanelId: "ScenePanel"
            }
          }
        }, n);
        await this.setupPanels();
        Editor.panelManager.loadLayout();
        Editor.panelManager.start();
        if (e) {
          await this.onOpenFile(e);
        } else {
          await this.restoreTabs();
        }
      }
      async onBeforeEndPlay() {
        return this._tabBar.queryToCloseAllTabs(true);
      }
      async onEndPlay() {
        Editor.setHistoryDocuments(this._tabBar.getTabs().map(e => e.assetId || ""), this._tabBar.selectedIndex);
      }
      async onOpenFile(e) {
        let t = await Editor.assetDb.getAsset(e);
        if (t) {
          this.openFileInside(t, true);
        }
      }
      async restoreTabs() {
        let {
          files: e,
          active: t
        } = Editor.getHistoryDocuments();
        for (let t of e) {
          try {
            let e = await Editor.assetDb.getAsset(t);
            if (e) {
              await this.openFileInside(e, false);
            }
          } catch (e) {}
        }
        if (t < this._tabBar.tabCount) {
          this._tabBar.selectedTab = this._tabBar.getTabAt(t);
        }
      }
      async openFileInside(e, t) {
        let i;
        if ((i = this._tabBar.findTab(t => t.assetId == e.id)) == null) {
          i = {
            id: (0, h.genShortId2)(),
            assetId: e.id,
            fileType: e.type,
            isModified: false
          };
          this._tabBar.addTab(i, null, t);
        } else if (t) {
          this._tabBar.selectedTab = i;
        }
      }
      async _save(e, i, n) {
        t.ScenePanel.ins.save();
        return true;
      }
      async save(e) {
        return this._save(null, false, e);
      }
      async saveAs() {
        return this._save(null, true);
      }
      async saveAll() {
        for (let e of this._tabBar.getTabs()) {
          if (!(await this._save(e))) {
            break;
          }
        }
      }
      queryToSaveAll() {
        return this._tabBar.queryToSaveAllTabs();
      }
      async setupPanels() {
        let e = Editor.panelManager;
        await Promise.all([e.registerPanel("BlueprintUniformPanel", a.BlueprintUniformPanel, {
          title: "Params",
          icon: "~/ui/type-icons/panel/inspector.svg",
          stretchPriorityX: -1,
          stretchPriorityY: 100,
          location: "left"
        }), e.registerPanel("ScenePanel", t.ScenePanel, {
          title: "",
          icon: "~/ui/type-icons/panel/scene.svg",
          stretchPriorityX: 1,
          stretchPriorityY: 1
        }), e.registerPanel("BlueprintInspectorPanel", i.BlueprintInspectorPanel, {
          title: "Inspector",
          icon: "~/ui/type-icons/panel/inspector.svg",
          stretchPriorityX: -1,
          stretchPriorityY: 100,
          location: "left"
        }), e.registerPanel("BlueprintPreviewPanel", n.BlueprintPreviewPanel, {
          title: "Preview",
          icon: "~/ui/type-icons/panel/preview.svg",
          stretchPriorityX: -1,
          stretchPriorityY: 100,
          location: "left"
        })]);
      }
      async onTabWillClose(e, t) {
        let i = e.length == this._tabBar.tabCount;
        if (t) {
          for (let t of e) {
            if (t.isModified && !(await this._save(t))) {
              return;
            }
          }
        }
        let n = [];
        for (let t of e) {
          this._tabBar.removeTab(t.id);
        }
        if (n.length > 0) {
          await Promise.all(n);
        }
        if (i) {
          Editor.shutdown();
        }
      }
      async onTabSave(e) {
        for (let t of e) {
          t.isModified;
        }
      }
      async onTabSelected(e) {
        t.ScenePanel.ins.openFile(this._tabBar, e, e.assetId);
      }
    });
  })();

})()

Logs

No response

@AILHC AILHC added the bug Something isn't working label Mar 22, 2024
@j4k0xb j4k0xb added the webpack label Mar 22, 2024
@j4k0xb
Copy link
Owner

j4k0xb commented Mar 22, 2024

That's being reworked atm in #50

It already detects bundles without an entry id (__webpack_require__.s = <id> or return __webpack_require__(<id>))
But what's left is extracting the entry module in the iife ((() => { ... })() at the bottom) instead of inside __webpack_modules__
image

@j4k0xb j4k0xb linked a pull request Mar 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working webpack
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants