 {Emitter} = require 'emissary'
 Q = require 'q'
 
-{$} = require './space-pen-extensions'
+$ = null # Defer require in case this is in the window-less browser process
 ScopedProperties = require './scoped-properties'
 
 # Loads and activates a package's main module and resources such as

  handleActivationEvent: (event) =>
    bubblePathEventHandlers = @disableEventHandlersOnBubblePath(event)
    @activateNow()
    $(event.target).trigger(event)
    @restoreEventHandlersOnBubblePath(bubblePathEventHandlers)
    @unsubscribeFromActivationEvents()

  disableEventHandlersOnBubblePath: (event) ->
    bubblePathEventHandlers = []
    disabledHandler = ->
    $ ?= require('./space-pen-extensions').$
    element = $(event.target)
    while element.length
      if eventHandlers = element.handlers()?[event.type]
