-
-
Save rgm/9ebc632a19074dea1a69955336fd3c8c to your computer and use it in GitHub Desktop.
Excluding CDN react from a shadow build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width" /> | |
<title>dev</title> | |
<script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script> | |
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script> | |
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet" type="text/css"> | |
</head> | |
<body class="container mx-auto"> | |
<main> | |
<h1 class="text-lg font-bold mb-4">guesser</h1> | |
<div id="guesser-app"></div> | |
<h1 class="text-lg font-bold mt-8 mb-4">ticker</h1> | |
<div id="ticker-app"></div> | |
</main> | |
<script src="/app/js/shared.js"></script> | |
<script src="/app/js/guesser.js"></script> | |
<script src="/app/js/ticker.js"></script> | |
<script charset="utf-8">guesser.main.start();</script> | |
<script charset="utf-8">ticker.main.start();</script> | |
</body> | |
</html> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"devDependencies": { | |
"karma": "^6.3.4", | |
"karma-cljs-test": "^0.1.0", | |
"karma-firefox-launcher": "^2.1.1", | |
"shadow-cljs": "2.14.5" | |
}, | |
"dependencies": { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns react | |
"Stubs React for the compiler so we can lean on an already-present CDN copy.") | |
(assert js/React "make sure React is loaded via <script> tag") | |
(def Children js/React.Children) | |
(def Component js/React.Component) | |
(def Fragment js/React.Fragment) | |
(def createElement js/React.createElement) | |
(def memo js/React.useMemo) | |
(def useEffect js/React.useEffect) | |
(def useRef js/React.useRef) | |
(def useState js/React.useState) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns react-dom | |
"Stubs ReactDOM for the compiler so we can lean on an already-present CDN copy.") | |
(assert js/ReactDOM "make sure ReactDOM is loaded via <script> tag") | |
(def findDOMNode js/ReactDOM.findDOMNode) | |
(def render js/ReactDOM.render) | |
(def unmountComponentAtNode js/ReactDOM.unmountComponentAtNode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns react-dom-server) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; shadow-cljs configuration | |
{:builds {:app {:target :browser | |
:output-dir "resources/public/app/js" | |
:asset-path "/app/js" | |
:modules {:shared {:entries [common.core]} | |
:guesser {:entries [guesser.main] | |
:depends-on #{:shared}} | |
:ticker {:entries [ticker.main] | |
:depends-on #{:shared}}} | |
:build-hooks [(shadow.cljs.build-report/hook | |
{:output-to "build_report.html"})]} | |
:test {:target :karma | |
:output-to "target/shadow-karma.js"}} | |
:dev-http {9000 "resources/public"} | |
:dependencies [[cljs-bean/cljs-bean "1.7.0"] | |
[com.taoensso/timbre "5.1.2"] | |
[fork/fork "2.4.1"] | |
[reagent/reagent "1.1.0"]] | |
:source-paths ["dev" "src" "test"]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment