This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-07
Channels
- # announcements (3)
- # babashka (28)
- # bangalore-clj (6)
- # beginners (91)
- # calva (14)
- # cider (7)
- # clojars (6)
- # clojure (24)
- # clojure-europe (3)
- # clojure-nl (5)
- # clojure-uk (134)
- # clojuredesign-podcast (1)
- # clojurescript (16)
- # cryogen (3)
- # cursive (3)
- # data-science (1)
- # events (1)
- # fulcro (7)
- # jobs-discuss (1)
- # luminus (4)
- # malli (1)
- # re-frame (7)
- # shadow-cljs (74)
- # spacemacs (23)
- # sql (6)
- # tools-deps (2)
can I make shadow-cljs only bundle parts of javascript that is required? or should I use double bundle with webpack instead?
@doglooksgood not sure what you mean. shadow-cljs always only bundles javascript that is required?
@thheller I see, I means sometime a javascript file may include other files. like
require A from "a";
require B from "b";
module.exports {
a: A,
b: B
}
since there's an object that contains a and b, If I require this file in cljs, both a and b will be bundled no matter I use them or not.But in library like
https://github.com/FortAwesome/react-fontawesome#explicit-import
It is said, when using webpack, explicit import will let you to only bundle what you need.
import { faCoffee } from '@fortawesome/free-solid-svg-icons'
only include the faCoffee, even though '@fortawesome/free-solid-svg-icons'
represent a index.js
that require all files.
@doglooksgood yes that style is not supported. however you can probably just do ["@fortawesome/free-solid-svg-icons/faCoffee" :as faCoffee]
(maybe :default
not :as
) to get the same effect?
Is it possible to use closure compiler to optimize javascript library, or how can I know if a library can be optimized by closure compiler?
if the library is purely strict ESM and only have strict ESM dependencies then in theory it can be optimized by the closure compiler
I just curious about, what if, ClojureScript do dead code eliminate by its compiler and don't rely on closure library and closure compiler ? is it a good direction in your sight?
in theory that would be nice yes. in practice it doesn't work with a very large percentage of npm packages (I'd guess 90%+)
if they ever get their act together and follow the standards then maybe that gets better over time. today it is not practical
reasons vary .. either they include "dynamic" code that isn't compatible with the closure-compiler
If ClojureScript drop closure compiler, and act like a babel transpiler, is it possible?
I don't see closure library is wildly used by clojurescript programmers and libraries. It almost provide everything but just not be considered as mainstream, and looks like few people and libraries use it.
most people see it as a negative for some reason. for me its just positive so I have no interest whatsoever in efforts to replace it.
you mean closure compiler provide optimizations, that's good choice, no matter use closure library or not, you will still use closure compiler?
FWIW I think it would have some value if the CLJS compiler just emitted strict ESM code
but many things we love in clojurescript and rely on are not possible with strict ESM code (eg. hot-reload, REPL) so it would need to be transpiled to something else to enable that
Three years before, the hot-reload is a magic, but know it's just a standard. Almost every JavaScript toolchain support that.
I don't have any experience of F# and Fable(F# on JS), but how fable work is just implement a loader, and configure it in webpack.
{
test: /\.fs(x|proj)?$/,
use: {
loader: "fable-loader",
options: {
babel: babelConf
}
}
}
if you want to build a loader go do that. many people would be interested in that I think.
I don't think webpack is positive, it's too complex. But sometimes I still need that simply import some css or fonts.
I made comments about why I'm not interested in webpack loaders in the past so you should be able to find it
just an fyi for others, I was curious and found the discussion here: https://github.com/thheller/shadow-cljs/issues/123#issuecomment-340246560
there are several levels, for I) I don't want use JS syntax, II) I don't want use JS build tool, III) I don't want use JS lib repository(npm), IV) I don't want JS dependency
Hi, I'm trying to put in place some test and I would like to know which namespace shadow-cljs found when it scan my project. Is there a way ask which test namespace has been found by shadow-cljs?
@fabien.rozar ask how? I mean do you want to ask "does namespace x.y.z exist?", meaning direct lookup by name?
@tekacs thanks! The idea is load the file in macro and insert into <script>
in runtime?