Skip to content

Commit

Permalink
Merge pull request #978 from ember-cli/plain-library2
Browse files Browse the repository at this point in the history
hide global require from webpack
  • Loading branch information
ef4 authored Sep 11, 2024
2 parents fd6b87a + a22a537 commit a51d352
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 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
6 changes: 4 additions & 2 deletions addon/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Resolver as ResolverContract } from "@ember/owner";
import EmberObject from "@ember/object";
export default class Resolver extends EmberObject {}

export default class Resolver {
static create(props: Record<string, unknown>): InstanceType<this>;
}
export default interface Resolver extends Required<ResolverContract> {
pluralizedTypes: Record<string, string>;
}

0 comments on commit a51d352

Please sign in to comment.