Fork me on GitHub
#shadow-cljs
<
2021-10-07
>
neural02:10:06

hi everyone! it is possible to load an .js file direct with (:require ["../components/Button" :as btn]) ??? then got this error:

Compilation failed!

------ ERROR -------------------------------------------------------------------
 File: .../src/stories/components/Button.js:8:2
--------------------------------------------------------------------------------
   5 | const Button = (props) => {
   6 |     const { variant, children, size, fontw, color, ...rest} = props;
   7 |     return (
   8 | 	<button className={`button ${variant}`}
--------^-----------------------------------------------------------------------
primary expression expected
--------------------------------------------------------------------------------
   9 | 		style={{width: `${size}`,
  10 | 		        color: `${color}`,
  11 | 			fontWeight: `${fontw}`}}>
  12 | 	    {children.toUpperCase()}
--------------------------------------------------------------------------------

neural02:10:41

... src/stories is in the classpath

bbss02:10:09

@neural.works.com :as aliased is for the namespace so you can refer to all the stuff in the ns with the aliased/thing, you probably want to use :default for the default export. The error might be about something else though, it seems the JSX is confusing the compilation.

bbss02:10:03

You'll need to pre-process that JS with something like babel. https://shadow-cljs.github.io/docs/UsersGuide.html#_javascript_dialects

myguidingstar09:10:25

I got an error "Cannot infer target type in expression" with this expression: (-> "" (goog.string.Const/from) (goog.html.TrustedResourceUrl/fromConstant) (.jsloader/safeLoad) (.addCallback some-callback-func))

myguidingstar09:10:11

I thought functions from closure library will work out of the box?

myguidingstar09:10:14

(`addCallback` is a method of the Deferred object returned by safeLoad)

Ryan Jerue15:10:16

On shadowcljs 2.15.10 , getting an error in ie11 (I hate it too). I think this is because there is a single / for what looks like a regex. I have output set es5 … es6 is what should support the single / regex. This didn’t happen on the version I had previously, 2.11.23 . Is there another flag I need to set?

Ryan Jerue15:10:17

It looks like its because something is translating this utility in corejs incorrectly

Ryan Jerue18:10:57

Older version of shadow has it looking like shadow$provide[1694]=function(_c_,_a_,_e_,_b_){c=a(1556);b.UNSUPPORTED_Y=c(function(){var d=_RegExp_("a","y");d.lastIndex=2;return null!=d.exec("abcd")});b.BROKEN_CARET=c(function(){var d=_RegExp_("^r","gy");d.lastIndex=2;return null!=d.exec("str")})};

myguidingstar15:10:18

I got NullPointerException for a release build whenever :source-map true and :source-map-include-sources-contentboth set to true. It compiles when either set to false. Is it a bug?

thheller16:10:38

hard to say without a repro. could be a problem in how shadow-cljs hands the data over to the closure compiler or just a bug in the closure compiler. can't say, never seen that before