stereobooster / react-snap

👻 Zero-configuration framework-agnostic static prerendering for SPAs
MIT License
5.04k stars 391 forks source link

Windows WSL - pageerror at /: SyntaxError: Unexpected token '.' #509

Open bknill opened 3 years ago

bknill commented 3 years ago

Bug Report

Current Behavior A clear and concise description of the behavior.

I'm running this under WSL (Windows Subsystem for Linux) and get this error pageerror at /: SyntaxError: Unexpected token '.' when it starts. My collegues on Linux and Mac can run it fine.

Assume something to do with paths, any idea how to find it?

If I remove CSS, error is Unexpected token '<'` if I remove JS, there are no errors.

Reproducible demo Link to GitHub repository or codesandbox with a demo of the bug behavior.

Expected behavior/code A clear and concise description of what you expected to happen (or code).

Possible Solution

Additional context/Screenshots Add any other context about the problem here. If applicable, add screenshots to help explain.

<ref *1> Page {
  _events: [Object: null prototype] {
    console: [Function (anonymous)],
    error: [Function (anonymous)],
    pageerror: [Function (anonymous)],
    response: [ [Function (anonymous)], [AsyncFunction (anonymous)] ]
  },
  _eventsCount: 4,
  _maxListeners: undefined,
  _closed: false,
  _client: CDPSession {
    _events: [Object: null prototype] {
      'Fetch.requestPaused': [Function: bound _onRequestPaused],
      'Fetch.authRequired': [Function: bound _onAuthRequired],
      'Network.requestWillBeSent': [Function: bound _onRequestWillBeSent],
      'Network.requestServedFromCache': [Function: bound _onRequestServedFromCache],
      'Network.responseReceived': [Function: bound _onResponseReceived],
      'Network.loadingFinished': [Function: bound _onLoadingFinished],
      'Network.loadingFailed': [Function: bound _onLoadingFailed],
      'Page.frameAttached': [Function (anonymous)],
      'Page.frameNavigated': [Function (anonymous)],
      'Page.navigatedWithinDocument': [Function (anonymous)],
      'Page.frameDetached': [Function (anonymous)],
      'Page.frameStoppedLoading': [Function (anonymous)],
      'Runtime.executionContextCreated': [Function (anonymous)],
      'Runtime.executionContextDestroyed': [Function (anonymous)],
      'Runtime.executionContextsCleared': [Function (anonymous)],
      'Page.lifecycleEvent': [Function (anonymous)],
      'Target.attachedToTarget': [Function (anonymous)],
      'Target.detachedFromTarget': [Function (anonymous)],
      'Page.domContentEventFired': [Function (anonymous)],
      'Page.loadEventFired': [Function (anonymous)],
      'Runtime.consoleAPICalled': [Function (anonymous)],
      'Runtime.bindingCalled': [Function (anonymous)],
      'Page.javascriptDialogOpening': [Function (anonymous)],
      'Runtime.exceptionThrown': [Function (anonymous)],
      'Inspector.targetCrashed': [Function (anonymous)],
      'Performance.metrics': [Function (anonymous)],
      'Log.entryAdded': [Function (anonymous)],
      'Page.fileChooserOpened': [Function (anonymous)]
    },
    _eventsCount: 28,
    _maxListeners: undefined,
    _callbacks: Map(0) {},
    _connection: Connection {
      _events: [Object: null prototype],
      _eventsCount: 4,
      _maxListeners: undefined,
      _url: 'ws://127.0.0.1:49424/devtools/browser/0a1a80c2-aca5-4f9c-bb6d-5b5a0ac1b2a6',
      _lastId: 22,
      _callbacks: Map(0) {},
      _delay: 0,
      _transport: [WebSocketTransport],
      _sessions: [Map],
      _closed: false,
      [Symbol(kCapture)]: false
    },
    _targetType: 'page',
    _sessionId: 'AD332D5E3496DD1624B08FA2E3337C9D',
    [Symbol(kCapture)]: false
  },
  _target: Target {
    _targetInfo: {
      targetId: 'B287CF4818AB98821BDD641245E854EB',
      type: 'page',
      title: 'localhost:45678',
      url: 'http://localhost:45678/',
      attached: true,
      browserContextId: '9DB0518F26DCD0AB27ACDE91806A3C56'
    },
    _browserContext: BrowserContext {
      _events: [Object: null prototype] {},
      _eventsCount: 0,
      _maxListeners: undefined,
      _connection: [Connection],
      _browser: [Browser],
      _id: null,
      [Symbol(kCapture)]: false
    },
    _targetId: 'B287CF4818AB98821BDD641245E854EB',
    _sessionFactory: [Function (anonymous)],
    _ignoreHTTPSErrors: false,
    _defaultViewport: { width: 800, height: 600 },
    _screenshotTaskQueue: TaskQueue { _chain: [Promise] },
    _pagePromise: Promise { [Circular *1] },
    _workerPromise: null,
    _initializedCallback: [Function (anonymous)],
    _initializedPromise: Promise { true },
    _closedCallback: [Function (anonymous)],
    _isClosedPromise: Promise { <pending> },
    _isInitialized: true
  },
  _keyboard: Keyboard {
    _client: CDPSession {
      _events: [Object: null prototype],
      _eventsCount: 28,
      _maxListeners: undefined,
      _callbacks: Map(0) {},
      _connection: [Connection],
      _targetType: 'page',
      _sessionId: 'AD332D5E3496DD1624B08FA2E3337C9D',
      [Symbol(kCapture)]: false
    },
    _modifiers: 0,
    _pressedKeys: Set(0) {}
  },
  _mouse: Mouse {
    _client: CDPSession {
      _events: [Object: null prototype],
      _eventsCount: 28,
      _maxListeners: undefined,
      _callbacks: Map(0) {},
      _connection: [Connection],
      _targetType: 'page',
      _sessionId: 'AD332D5E3496DD1624B08FA2E3337C9D',
      [Symbol(kCapture)]: false
    },
    _keyboard: Keyboard {
      _client: [CDPSession],
      _modifiers: 0,
      _pressedKeys: Set(0) {}
    },
    _x: 0,
    _y: 0,
    _button: 'none'
  },
  _timeoutSettings: TimeoutSettings {
    _defaultTimeout: null,
    _defaultNavigationTimeout: null
  },
  _touchscreen: Touchscreen {
    _client: CDPSession {
      _events: [Object: null prototype],
      _eventsCount: 28,
      _maxListeners: undefined,
      _callbacks: Map(0) {},
      _connection: [Connection],
      _targetType: 'page',
      _sessionId: 'AD332D5E3496DD1624B08FA2E3337C9D',
      [Symbol(kCapture)]: false
    },
    _keyboard: Keyboard {
      _client: [CDPSession],
      _modifiers: 0,
      _pressedKeys: Set(0) {}
    }
  },
  _accessibility: Accessibility {
    _client: CDPSession {
      _events: [Object: null prototype],
      _eventsCount: 28,
      _maxListeners: undefined,
      _callbacks: Map(0) {},
      _connection: [Connection],
      _targetType: 'page',
      _sessionId: 'AD332D5E3496DD1624B08FA2E3337C9D',
      [Symbol(kCapture)]: false
    }
  },
  _frameManager: <ref *2> FrameManager {
    _events: [Object: null prototype] {
      [Symbol(Events.FrameManager.FrameAttached)]: [Function (anonymous)],
      [Symbol(Events.FrameManager.FrameDetached)]: [Function (anonymous)],
      [Symbol(Events.FrameManager.FrameNavigated)]: [Function (anonymous)]
    },
    _eventsCount: 3,
    _maxListeners: undefined,
    _client: CDPSession {
      _events: [Object: null prototype],
      _eventsCount: 28,
      _maxListeners: undefined,
      _callbacks: Map(0) {},
      _connection: [Connection],
      _targetType: 'page',
      _sessionId: 'AD332D5E3496DD1624B08FA2E3337C9D',
      [Symbol(kCapture)]: false
    },
    _page: [Circular *1],
    _networkManager: NetworkManager {
      _events: [Object: null prototype],
      _eventsCount: 4,
      _maxListeners: undefined,
      _client: [CDPSession],
      _ignoreHTTPSErrors: false,
      _frameManager: [Circular *2],
      _requestIdToRequest: Map(0) {},
      _requestIdToRequestWillBeSentEvent: Map(0) {},
      _extraHTTPHeaders: {},
      _offline: false,
      _credentials: null,
      _attemptedAuthentications: Set(0) {},
      _userRequestInterceptionEnabled: false,
      _protocolRequestInterceptionEnabled: false,
      _userCacheDisabled: false,
      _requestIdToInterceptionId: Map(0) {},
      [Symbol(kCapture)]: false
    },
    _timeoutSettings: TimeoutSettings {
      _defaultTimeout: null,
      _defaultNavigationTimeout: null
    },
    _frames: Map(1) { 'B287CF4818AB98821BDD641245E854EB' => [Frame] },
    _contextIdToContext: Map(2) { 3 => [ExecutionContext], 4 => [ExecutionContext] },
    _isolatedWorlds: Set(1) { '__puppeteer_utility_world__' },
    _mainFrame: Frame {
      _frameManager: [Circular *2],
      _client: [CDPSession],
      _parentFrame: null,
      _url: 'http://localhost:45678/',
      _id: 'B287CF4818AB98821BDD641245E854EB',
      _detached: false,
      _loaderId: '69208FECEB94A6F64CBE87106DAB7C4A',
      _lifecycleEvents: [Set],
      _mainWorld: [DOMWorld],
      _secondaryWorld: [DOMWorld],
      _childFrames: Set(0) {},
      _name: undefined,
      _navigationURL: 'http://localhost:45678/'
    },
    [Symbol(kCapture)]: false
  },
  _emulationManager: EmulationManager {
    _client: CDPSession {
      _events: [Object: null prototype],
      _eventsCount: 28,
      _maxListeners: undefined,
      _callbacks: Map(0) {},
      _connection: [Connection],
      _targetType: 'page',
      _sessionId: 'AD332D5E3496DD1624B08FA2E3337C9D',
      [Symbol(kCapture)]: false
    },
    _emulatingMobile: false,
    _hasTouch: false
  },
  _tracing: Tracing {
    _client: CDPSession {
      _events: [Object: null prototype],
      _eventsCount: 28,
      _maxListeners: undefined,
      _callbacks: Map(0) {},
      _connection: [Connection],
      _targetType: 'page',
      _sessionId: 'AD332D5E3496DD1624B08FA2E3337C9D',
      [Symbol(kCapture)]: false
    },
    _recording: false,
    _path: ''
  },
  _pageBindings: Map(0) {},
  _coverage: Coverage {
    _jsCoverage: JSCoverage {
      _client: [CDPSession],
      _enabled: false,
      _scriptURLs: Map(0) {},
      _scriptSources: Map(0) {},
      _eventListeners: [],
      _resetOnNavigation: false
    },
    _cssCoverage: CSSCoverage {
      _client: [CDPSession],
      _enabled: false,
      _stylesheetURLs: Map(0) {},
      _stylesheetSources: Map(0) {},
      _eventListeners: [],
      _resetOnNavigation: false
    }
  },
  _javascriptEnabled: true,
  _viewport: { width: 480, height: 850 },
  _screenshotTaskQueue: TaskQueue { _chain: Promise { undefined } },
  _workers: Map(0) {},
  _fileChooserInterceptionIsDisabled: false,
  _fileChooserInterceptors: Set(0) {},
  [Symbol(kCapture)]: false
}