Skip to content

Commit

Permalink
Remove webpackDevServer and isHMR, see phetsims/chipper#1461
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Oct 14, 2024
1 parent 160b3dd commit fc359c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 66 deletions.
22 changes: 7 additions & 15 deletions js/Namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* @author Chris Malley (PixelZoom, Inc.)
*/

import isHMR from './isHMR.js';

class Namespace {
public readonly name: string;

Expand Down Expand Up @@ -63,11 +61,9 @@ class Namespace {

// If the key isn't compound (doesn't contain '.'), we can just look it up on this namespace
if ( key.includes( '.' ) ) {
if ( !isHMR ) {

// @ts-expect-error
assert && assert( !this[ key ], `${key} is already registered for namespace ${this.name}` );
}
// @ts-expect-error
assert && assert( !this[ key ], `${key} is already registered for namespace ${this.name}` );

// @ts-expect-error
this[ key ] = value;
Expand All @@ -80,11 +76,9 @@ class Namespace {
let parent = this; // eslint-disable-line consistent-this, @typescript-eslint/no-this-alias
for ( let i = 0; i < keys.length - 1; i++ ) { // for all but the last key

if ( !isHMR ) {
// @ts-expect-error
assert && assert( !!parent[ keys[ i ] ],
`${[ this.name ].concat( keys.slice( 0, i + 1 ) ).join( '.' )} needs to be defined to register ${key}` );
}
// @ts-expect-error
assert && assert( !!parent[ keys[ i ] ],
`${[ this.name ].concat( keys.slice( 0, i + 1 ) ).join( '.' )} needs to be defined to register ${key}` );

// @ts-expect-error
parent = parent[ keys[ i ] ];
Expand All @@ -93,10 +87,8 @@ class Namespace {
// Write into the inner namespace, e.g. x.A.B[ 'C' ] = C
const lastKey = keys[ keys.length - 1 ];

if ( !isHMR ) {
// @ts-expect-error
assert && assert( !parent[ lastKey ], `${key} is already registered for namespace ${this.name}` );
}
// @ts-expect-error
assert && assert( !parent[ lastKey ], `${key} is already registered for namespace ${this.name}` );

// @ts-expect-error
parent[ lastKey ] = value;
Expand Down
51 changes: 0 additions & 51 deletions js/isHMR.ts

This file was deleted.

0 comments on commit fc359c5

Please sign in to comment.