Git Product home page Git Product logo

cljs-report-20171109's Introduction

Instruction to Reproduce the Possible Bug

0. clone this repo
1. use latest JDK 8
2. download cljs.jar from clojurescript 1.9.946 https://github.com/clojure/clojurescript/releases/tag/r1.9.946
3. execute this on repo directory
   `java -cp cljs.jar:src clojure.main repl.clj`
4. Open Chrome browser on http://localhost:9000 and open the inspector tool
5. Click the `Load Bar!` button
6. See the error on console log

Description

Fails to load required google closure's namespace in the loaded module.

The codes here are taken from the guide https://clojurescript.org/guides/code-splitting and modified to reproduce the bugs.

basically, I modified the src/bar/core.cljs from above guide like this:

(ns bar.core
  (:require 
  [goog.net.cookies :as gcookies] ;; I require goog.net.cookies
  [cljs.loader :as loader]))

(enable-console-print!)

(defn cookie-enabled? ;; I create wrapper function
  []
  (.isEnabled goog.net.cookies))

(println "I'm bar!")

(defn woz []
  (println "WOZ!")
  (println "cookie enabled?" (cookie-enabled?))) ;; call cookie-enabled?

(loader/set-loaded! :bar)

The result in chrome's console when I click the Load Bar! button in the browser are:

Uncaught TypeError: Cannot read property 'isEnabled' of undefined
    at bar$core$cookie_enabled_QMARK_ (eval at goog.globalEval (base.js:2184), <anonymous>:8:24)
    at bar$core$woz (eval at goog.globalEval (base.js:2184), <anonymous>:14:85)
    at cljs.core.Var.G__9692__1 (core.cljs:1123)
    at cljs.core.Var.G__9692 [as call] (core.cljs:1164)
    at core.cljs:17
    at goog.module.ModuleLoadCallback.execute (moduleloadcallback.js:60)
    at goog.module.ModuleInfo.callCallbacks_ (moduleinfo.js:324)
    at goog.module.ModuleInfo.onLoad (moduleinfo.js:271)
    at goog.module.ModuleManager.setLoaded (modulemanager.js:831)
    at cljs$loader$set_loaded_BANG_ (loader.cljs:80)

but if I click the Load Bar! button again, everything works and the chrome's console prints:

WOZ!
cookie enabled? true

cljs-report-20171109's People

Contributors

mavbozo avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.