cljsjs

martinklepsch 2017-01-28T05:01:41.000795Z

@pupeno haven’t had that particular issue but I’d have to guess you might need to use a different file?

pupeno 2017-01-28T13:08:28.000797Z

@martinklepsch what do you man by a different file?

martinklepsch 2017-01-28T14:43:21.000798Z

@pupeno it sounds as if maybe the file you specified as file/`file-min` isn’t intended for in-browser usage

martinklepsch 2017-01-28T14:43:33.000799Z

(I’m purely speculating but that would be what I’d check)

pupeno 2017-01-28T14:44:39.000800Z

I'm not sure what to check. The library is for use in the browser and I can use it in my ClojureScript app if I include it directly, but it's messy, so, I want to package it with cljsjs

martinklepsch 2017-01-28T14:45:55.000801Z

> I can use it in my ClojureScript app if I include it directly Are you certain that the file you use in that case is the same file that you know bundled with CLJSJS?

pupeno 2017-01-28T14:46:36.000802Z

@martinklepsch well, no. The file is compiled by webpack separately in my app and in the cljsjs but the webpack config is as similar as I could generate it.

martinklepsch 2017-01-28T14:48:52.000803Z

Seems likely that there is a difference in configuration (webpack) that’s causing the error

pupeno 2017-01-28T14:50:58.000804Z

@martinklepsch I added the working webpack.config here: http://stackoverflow.com/questions/41905042/webpack-babel-react-react-transform-hmr

martinklepsch 2017-01-28T14:51:59.000806Z

Don’t know anything about webpack unfortunately

pupeno 2017-01-28T14:52:04.000807Z

Oh... ok 😞

juhoteperi 2017-01-28T15:39:34.000810Z

@pupeno npm run build runs gulp -> babel and configuration in react-toolbox uses that react-transform-hmr transformation: https://github.com/react-toolbox/react-toolbox/blob/dev/.babelrc#L8

juhoteperi 2017-01-28T15:39:46.000812Z

perhaps that somehow conflicts with Cljs

pupeno 2017-01-28T15:40:33.000813Z

Mhhh… I think I tried with and without it.... let me see.

juhoteperi 2017-01-28T15:40:41.000814Z

That transformation is only enabled in development mode (`process.NODE_ENV`) so if you other project is using production or something, it wouldn't be using that

pupeno 2017-01-28T15:41:14.000815Z

juhoteperi well… I’m not even sure what’s the state of NODE_ENV in a cljs project.

juhoteperi 2017-01-28T15:41:27.000816Z

You were running webpack?

pupeno 2017-01-28T15:41:59.000817Z

I have a project with a webpack but I’m trying to remove that as the only reason to have that was react-toolbox that I’m trying to pack.

pupeno 2017-01-28T15:42:40.000818Z

By the way, doing npm install --production, had a completely different outcome (different error)

pupeno 2017-01-28T15:53:39.000819Z

So, running or not npm build makes not difference, I get the same error.

juhoteperi 2017-01-28T15:55:37.000820Z

You probably need to run the npm build, but did you tryin running it with NODE_ENV=production set?

pupeno 2017-01-28T15:56:07.000821Z

No… I’m not sure how to do that in boot. Do you know?

juhoteperi 2017-01-28T15:57:23.000822Z

((sh "NODE_ENV=production" "npm" "run" "build"))

juhoteperi 2017-01-28T15:57:33.000823Z

Or you can also just set in in webpack config: https://github.com/cljsjs/packages/blob/a486e6af0389a1d2754e3a21e7772f082b208815/react-highlight/resources/webpack.config.js#L2

pupeno 2017-01-28T15:58:28.000825Z

ok… rebuilding.

pupeno 2017-01-28T16:08:00.000826Z

That seems to have made the error go away. Awesome! thanks @juhoteperi

juhoteperi 2017-01-28T18:21:13.000828Z

Yes, that is possible. You should define React as "external" or something in the webpack config

pupeno 2017-01-28T18:30:52.000831Z

Yes, I have it as external.

pupeno 2017-01-28T20:33:01.000834Z

I defined a couple more externals:

pupeno 2017-01-28T20:33:53.000837Z

But it doesn’t seem to be working as expected:

pupeno 2017-01-28T20:34:20.000839Z

What am I missing here?