Skip to content

Commit

Permalink
hide global require from webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
ef4 committed Sep 11, 2024
1 parent fd6b87a commit a1246fd
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions addon/addon/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
/* globals requirejs, require */

import { dasherize, classify, underscore } from './string';
import classFactory from './utils/class-factory';

if (typeof requirejs.entries === 'undefined') {
requirejs.entries = requirejs._eak_seen;
if (typeof globalThis.requirejs.entries === 'undefined') {
globalThis.requirejs.entries = globalThis.requirejs._eak_seen;
}

export class ModuleRegistry {
constructor(entries) {
this._entries = entries || requirejs.entries;
this._entries = entries || globalThis.requirejs.entries;
}
moduleNames() {
return Object.keys(this._entries);
Expand All @@ -18,7 +16,7 @@ export class ModuleRegistry {
return moduleName in this._entries;
}
get(...args) {
return require(...args);
return globalThis.require(...args);
}
}

Expand Down

0 comments on commit a1246fd

Please sign in to comment.