This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-17
Channels
- # announcements (12)
- # babashka (27)
- # beginners (65)
- # biff (8)
- # calva (22)
- # clj-kondo (1)
- # clj-otel (5)
- # clojure (65)
- # clojure-europe (127)
- # clojure-nl (1)
- # clojure-norway (11)
- # clojure-portugal (2)
- # clojure-uk (2)
- # clojurescript (18)
- # cursive (5)
- # data-science (3)
- # datahike (14)
- # datascript (3)
- # datomic (7)
- # deps-new (11)
- # emacs (31)
- # exercism (1)
- # fulcro (1)
- # honeysql (3)
- # hyperfiddle (38)
- # introduce-yourself (4)
- # leiningen (2)
- # malli (20)
- # meander (2)
- # missionary (3)
- # off-topic (4)
- # pathom (3)
- # practicalli (2)
- # reagent (5)
- # releases (1)
- # sci (1)
- # shadow-cljs (9)
- # xtdb (8)
Does shadow perform any sort of dead code elimination for JS files? I have a JS file which exports a bunch of strings
export const a = "asdb";
export const b = "alksdj"
export const c = "lkajsd"
And then used in cljs
(ns app.core
(:require ["./file" :as f]))
(prn f/a)
I'd expect non-used vars from JS file to be removed from the output after advanced compilation. IIRC shadow transforms JS differently, but it's surprising that such a simple case is not handledESM code included like that go through :advanced
. so the gcc should remove b+c here?
haven't verified that in a while though. goog.module
files are similar and more reliable when it comes to DCE
goog.module("your.ns")
exports.a = "a";
exports.b = "b";
exports.c = "c";
and (:require [your.ns :as foo])
in the CLJS codehmm just did a quick check. looks like there are indeed not eliminated, not sure why
I've tried it again with the above minimal example (ESM) in a fresh project, seems to be removing unused exports. But in a project at work it doesn't work.