Fork me on GitHub
#shadow-cljs
<
2020-09-16
>
sb08:09:33

Is that possible compile shadow-cljs project into one single file "js-build" ["run" "-m" "shadow.cljs.devtools.cli" "release" "app"] which command or flag could help me? (that code from project.clj file)

thheller08:09:15

@sb the question is unclear. you are doing a release build which sounds like what you asked? what is the problem?

sb08:09:23

I would like to inject into one go project as frontend and for this would be great a single js file (because I need to compile into file, as fs attachment, different like in clojure)

sb08:09:07

maybe I forget the :advanced flag..

thheller08:09:11

I do not understand what you are asking here

thheller08:09:17

release produces an optimized build

thheller08:09:22

which is a single file

thheller08:09:27

unless you declared multiples :modules

sb08:09:39

hmm interesting

sb08:09:48

ok I check again, thanks!

thheller08:09:51

(assuming this is a :target :browser) build

sb08:09:14

Sorry for this question! I check again

thheller08:09:02

if the cljs-runtime dir confuses you that is from watch or compile builds and is not needed in release builds. you can optionally just clean out the :output-dir before running the release

đź‘Ť 3
sb08:09:35

thanks, yes that was the problem :face_with_rolling_eyes:

thheller09:09:28

you can also just use a different output-dir for release via :release {:output-dir "somewhere/else"} see https://shadow-cljs.github.io/docs/UsersGuide.html#_release_specific_vs_development_configuration

ikitommi09:09:01

hi. We have a mixed project of cljs & ts. What needs to be considered on writing reusable react-components with ts? I guess the style-requires on ts need to be handled somehow, getting module errors on those requires with shadow-cljs.

ikitommi09:09:20

currently using sass on both sides, but I guess plain css requires (on js/ts -side) don't work either?

thheller09:09:02

shadow-cljs has no support for compiling/handling CSS

thheller09:09:07

you can either compile the TS to regular ES6 code and include it directly via https://shadow-cljs.github.io/docs/UsersGuide.html#classpath-js

thheller09:09:55

that way the TS can see all the CLJS code and CLJS all the TS

thheller09:09:35

any other method will result in either the TS code not seeing CLJS or relying on globals to wire everything together

ikitommi11:09:34

thanks. got the ts & sass converted into js & css, but still have the css-requires in the react-components. Is there a easy way to strip those away on the js-side? e.g. the components look like this:

const Logo_1 = require("./Logo");
require("../styles/overlay.css");
const { Header, Content, Sider, Footer } = antd_1.Layout;
exports.Overlay = (props) => {
    return (React.createElement(antd_1.Layout, null, ...

ikitommi11:09:30

or is there a way for shadow-cljs not to fail on css requires? (as I can import them in my sass)

ikitommi11:09:42

my bad, actually a typo. sorry for the extra noice.

thheller11:09:18

you can let shadow-cljs ignore them via :js-options {:ignore-asset-requires true} but it is better to just avoid them to begin with

đź‘Ť 3
thheller09:09:02

what are style-requires? CSS I presume?

rickmoynihan12:09:04

A colleague wired up devcards and shadow-cljs; however I appear to be having some problems with the dependencies… In particlar shadow-cljs reports shadow-cljs - failed to load module$node_modules$highlight_DOT_js$lib$core

rickmoynihan12:09:28

Then some exceptions related to that

rickmoynihan12:09:15

I think it’s because devcards vendors dependencies on highlight.js and marked

thheller12:09:05

@rickmoynihan which shadow-cljs version and which :target?

rickmoynihan12:09:52

@thheller cli version: 2.8.26 node: v13.7.0 with :target :browser

thheller12:09:05

you can either upgrade or set :compiler-options {:output-feature-set :es6} in your build config

rickmoynihan12:09:48

ok I’ll try upgrading to 2.11.4

rickmoynihan12:09:50

hmm actually the cli version was different to the one in my deps.edn / package.json

rickmoynihan12:09:21

ok did yarn global add shadow-cljs and bumped to 2.11.4 and it seems to have fixed the issue