workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
elmlang
general
aah nice :slightly_smiling_face: congrats!
2019-03-04T10:10:10.407300
Moshe
elmlang
general
hi everyone, I'm struggling to have webpack 4 working with elm 0.19, in production mode
2019-03-04T11:13:18.409700
Sherill
elmlang
general
it works perfectly fine in dev, while in prod (with and without uglifyjs optimizations described on elm blog) it raises this error on a blank page:
2019-03-04T11:13:52.410500
Sherill
elmlang
general
`Uncaught TypeError: Cannot read property 'Elm' of undefined`
2019-03-04T11:13:55.410700
Sherill
elmlang
general
the stack trace points here
2019-03-04T11:14:08.411000
Sherill
elmlang
general
``` function _Platform_export(exports) { scope['Elm'] ? _Platform_mergeExportsProd(scope['Elm'], exports) : scope['Elm'] = exports; } ```
2019-03-04T11:14:16.411400
Sherill
elmlang
general
it’s not related to elm
2019-03-04T11:17:30.411700
Van
elmlang
general
yeah the stacktrace starts from the .js file where I import the main elm module...
2019-03-04T11:19:45.411900
Sherill
elmlang
general
I have something working with webpack and elm
2019-03-04T11:21:21.412100
Noelle
elmlang
general
<https://github.com/romariolopezc/elm-webpack-4-starter/blob/master/src/index.js>
2019-03-04T11:21:22.412300
Noelle
elmlang
general
Be sure that the index.html is importing the generated JS file
2019-03-04T11:21:35.412500
Noelle
elmlang
general
well, i'm importing the main module like this: `import { Elm } from "../elm/Crash.elm";`
2019-03-04T11:26:29.412700
Sherill
elmlang
general
and then initing like this: `const app = Elm.Crash.init({})`
2019-03-04T11:26:54.412900
Sherill
elmlang
general
inside `index.html`i'm including the bundle
2019-03-04T11:27:27.413100
Sherill
elmlang
general
What minimizer do you use?
2019-03-04T11:32:08.413300
Noelle
elmlang
general
UglifyJS doesn’t support ES6
2019-03-04T11:32:29.413500
Noelle
elmlang
general
Change to TerserJS and try it
2019-03-04T11:32:39.413700
Noelle
elmlang
general
oh, ok
2019-03-04T11:33:04.414000
Sherill
elmlang
general
it doesn't seem to be working either with TerserJS :confused:
2019-03-04T11:48:56.415000
Sherill
elmlang
general
Hmm copy paster the webpack template config and index.js and index.html haha
2019-03-04T12:01:56.415200
Noelle
elmlang
general
sure, will do tomorrow
2019-03-04T12:04:17.415400
Sherill
elmlang
general
thanks again!
2019-03-04T12:04:19.415600
Sherill
elmlang
general
I do a fresh installation: `npm i [email protected] -g` I try to build using: `elm-make ./src/scripts/MainModule.elm` I get: “elm-make: elm-package.json: openBinaryFile: does not exist (No such file or directory)” But the `elm-package.json` file is right in the directory where i’m calling `elm-make` from. Thoughts?
2019-03-04T12:58:00.416000
Shelli
elmlang
general
Is `elm-make` in your PATH? Is `elm`? Does your shell cache the command names from PATH (for ex zsh does this)?
2019-03-04T13:31:49.417400
Milda
elmlang
general
``` mac-mini:frontend admin$ which elm /Users/admin/.nvm/versions/node/v9.4.0/bin/elm mac-mini:frontend admin$ which elm-make /Users/admin/.nvm/versions/node/v9.4.0/bin/elm-make ``` Does this answer the first two?
2019-03-04T13:45:24.417900
Shelli
elmlang
general
How do I check for your third question?
2019-03-04T13:45:57.418100
Shelli
elmlang
general
If you're using `zsh` then running `exec zsh` might help for the current shell. Newly started ones should be fine.
2019-03-04T13:46:30.418400
Milda
elmlang
general
If it's bash or something else/something Mac-specific, I don't think this will happen.
2019-03-04T13:46:55.418600
Milda
elmlang
general
it’s regular mac bash shell
2019-03-04T13:47:32.418800
Shelli
elmlang
general
fresh machine installation
2019-03-04T13:47:43.419000
Shelli
elmlang
general
Stack Overflow here: <https://stackoverflow.com/q/54989374/592641>
2019-03-04T13:48:49.419200
Shelli
elmlang
general
And it's an `elm-package.json` not an `elm.json`, right?
2019-03-04T13:48:51.419500
Milda
elmlang
general
Discourse here: <https://discourse.elm-lang.org/t/elm-make-elm-package-json-openbinaryfile-does-not-exist/3260?u=birowsky>
2019-03-04T13:49:11.419800
Shelli
elmlang
general
correct
2019-03-04T13:49:29.420000
Shelli
elmlang
general
And does `$(which elm-make) ./src/scripts/MainModule.elm` have the same issue?
2019-03-04T13:50:51.420200
Milda
elmlang
general
yes, just tried
2019-03-04T13:51:31.420400
Shelli
elmlang
general
Other commands open it just fine? Ex `wc elm-package.json`?
2019-03-04T13:52:40.420700
Milda
elmlang
general
i tried nano, works fine
2019-03-04T13:53:00.420900
Shelli
elmlang
general
:thinking_face: You didn't rename/move the directory or something like that?
2019-03-04T13:56:36.421100
Milda
elmlang
general
(That's a real stretch but I'm failing to come up with anything else that could be wrong.)
2019-03-04T13:58:35.421300
Milda
elmlang
general
(If it's Mac specific I'll probably have no way to know. Also don't know how nvm might affect things. Sorry.)
2019-03-04T13:59:13.421500
Milda
elmlang
general
thanx for trying nonetheless!
2019-03-04T14:01:21.421700
Shelli
elmlang
general
Any good options beyond Electron for using Elm in a native app?
2019-03-04T14:29:39.422300
Leoma
elmlang
general
I think the answer is no. Is electron giving you trouble?
2019-03-04T14:32:05.422800
Ashton
elmlang
general
I haven’t yet started! Just wanted to know what else I should consider. I recall there being some other more “lightweight” options. And I thought I saw something on HN recently.
2019-03-04T14:34:22.423700
Leoma
elmlang
general
<https://crates.io/crates/web-view> might be the thing you saw (or it might be smth else)
2019-03-04T14:36:47.424500
Milda
elmlang
general
This will have some engine differences between platforms though.
2019-03-04T14:38:00.425500
Milda
elmlang
general
<https://deskgap.com/> is an interesting project that uses the platform’s built-in webview rather than bringing in all of chromium
2019-03-04T14:38:31.426200
Sabra
elmlang
general
theres also the go option that was announced at fosdem, but not ready for long. and if you ask me not very promissing
2019-03-04T15:17:23.427400
Desire
elmlang
general
<@Leoma> You can make a dead simple native wrapper with only a single fixed webView that opens your elm webapp? You can easily talk to native ios or android via ports. That is the most lightweight solution possible. And you have access to everyting on the native side via ports. I am doing this for an Augmented reality app I develop. (Camera is show on native side, and a fullscreen transperent elm webpage loads on top of the videoStream)
2019-03-04T18:40:17.440900
Monnie
elmlang
general
<https://twitter.com/horse_js/status/1102688550972284929?s=21>
2019-03-05T03:45:00.444300
Danika
elmlang
general
Well this doesn’t bode well
2019-03-05T03:45:05.444600
Danika
elmlang
general
although the whole webcomponent system is a big clusterf*ck anyway. V0 support has been dropped
2019-03-05T03:46:05.445400
Danika
elmlang
general
There doesn't seem to be any `Array.insert` in the core library or in `elm-community/array-extra`. Is there a different name for it or another library that includes it?
2019-03-05T03:48:45.446600
Jae
elmlang
general
Specifically, I want to be able to insert a value into an array at a given index.
2019-03-05T03:49:19.446700
Jae
elmlang
general
There is `Array.set`
2019-03-05T03:51:32.446900
Lynne
elmlang
general
That replaces the value at a given index though?
2019-03-05T03:52:01.447100
Jae
elmlang
general
Yes, it does
2019-03-05T03:52:09.447300
Lynne
elmlang
general
I'd like to be able to do this `['a','c'] |&gt; Array.fromList |&gt; Array.insert 1 'b' -- Equals ['a','b','c'] not ['a', 'b']`
2019-03-05T03:53:35.447500
Jae
elmlang
general
Inserting without replacing would effectively mean reconstructing array as other items need to be shifted as well
2019-03-05T03:53:55.447700
Lynne
elmlang
general
You may use `toIndexedList`, `foldl`/`foldr` and `fromList` to implement it yourself
2019-03-05T03:54:47.447900
Lynne
elmlang
general
or `slice` and `append`
2019-03-05T03:54:57.448100
Huong
elmlang
general
Right
2019-03-05T03:55:05.448300
Lynne
elmlang
general
Even if there are performance concerns it surprises me that it isn't included in array-extra. I'll implement it myself then, thanks!
2019-03-05T03:55:56.448600
Jae
elmlang
general
```insertAt : Int -&gt; a -&gt; Array a -&gt; Array a insertAt index val values = let before = Array.slice 0 index values after = Array.slice index (Array.length values) values in Array.append (Array.push val before) after```
2019-03-05T03:56:00.448800
Huong
elmlang
general
(or I'll just use your code)
2019-03-05T03:56:21.449000
Jae
elmlang
general
Might also be good to create PR in array-extra with it :wink:
2019-03-05T03:56:38.449200
Lynne
elmlang
general
Good point!
2019-03-05T03:56:52.449600
Jae
elmlang
general
Feel free - I just adapted that from some other code where I do a similar thing and happen to use arrays under the hood :slightly_smiling_face:
2019-03-05T03:57:32.449800
Huong
elmlang
general
<https://github.com/zwilias/elm-reorderable/blob/1.2.0/src/Reorderable.elm#L146-L156>
2019-03-05T03:57:39.450000
Huong
elmlang
general
hello everyone! is there a way I can encode a list of records that looks like this `[{ name = "filter", value = "" }, { name = "paginate", value = "yes" }]` to a json looking like this: `{"filter": "no", "paginate": "yes"}` ?
2019-03-05T04:57:08.451500
Karrie
elmlang
general
any help is appreciated
2019-03-05T04:57:22.451800
Karrie
elmlang
general
i've downgraded to webpack 3, using the configuration that worked for elm 0.18, and it gives the very same error, both on webpack 3 and 4...
2019-03-05T05:01:06.453300
Sherill
elmlang
general
`Encode.object (List.map (\{name, value} -&gt; (name, Encode.string value)) records)`
2019-03-05T05:01:33.454100
Lynne
elmlang
general
it really looks to be a problem with elm 0.19 and how it needs to be imported... I've even disabled any kind of optimization/mangling
2019-03-05T05:01:34.454300
Sherill
elmlang
general
Also convert empty string to "no" but that's a simple `if` expression
2019-03-05T05:01:47.454500
Lynne
elmlang
general
I use webpack 4 with Elm 0.19 and Babel and don't have any problem
2019-03-05T05:03:16.454900
Lynne
elmlang
general
So there is something with your libs/config
2019-03-05T05:03:30.455100
Lynne
elmlang
general
Did you upgrade `elm-webpack-loader` and replace `elm-hot-loader` with `elm-webpack-hot-loader`?
2019-03-05T05:03:48.455300
Lynne
elmlang
general
straight out of my `package.json`
2019-03-05T05:04:41.455600
Sherill
elmlang
general
``` "elm-hot-webpack-loader": "^1.0.2", "elm-webpack-loader": "^5.0" ```
2019-03-05T05:04:49.455800
Sherill
elmlang
general
Same
2019-03-05T05:05:06.456000
Lynne
elmlang
general
but really I'm not using HMR in dev, I'm serving development bundle from phoenix (elixir)
2019-03-05T05:05:08.456200
Sherill
elmlang
general
and my dev config works fine
2019-03-05T05:05:16.456400
Sherill
elmlang
general
Right, I remember now
2019-03-05T05:05:26.456600
Lynne
elmlang
general
in prod, it gives that very same error I posted yesterday
2019-03-05T05:05:30.456800
Sherill
elmlang
general
And you are not using Babel?
2019-03-05T05:05:45.457000
Lynne
elmlang
general
yes I am
2019-03-05T05:05:58.457200
Sherill
elmlang
general
would you mind if I post my webpack config?
2019-03-05T05:06:07.457400
Sherill
elmlang
general
it's very small
2019-03-05T05:06:10.457600
Sherill
elmlang
general
Nope, I was about to ask about it
2019-03-05T05:06:17.457800
Lynne
elmlang
general
we're planning to send an entire dataset to the browser, and filtering it there. I'm thinking if I should set up a webworker to do the fetching and filtering, in order to avoid blocking the UI
2019-03-05T06:47:26.459500
Nana
elmlang
general
the maximum amount of data would be around 50.000 rows, with a decent amount of data per row
2019-03-05T06:48:40.459600
Nana
elmlang
general
anyone tried something like this?
2019-03-05T06:50:31.459800
Nana
elmlang
general
Our app became unresponsive at amounts around 5000 objects (rows)
2019-03-05T06:53:14.460100
Lynne
elmlang
general
So in your case having a webworker is a must I think
2019-03-05T06:53:26.460300
Lynne
elmlang
general
Only 5000? :fearful: Are they huge objects then?
2019-03-05T06:55:09.460500
Nana
elmlang
general
Well, not that big but not small either. About ten fields with several child objects about ten fields each. Sometimes there were hundreds of those child objects though.
2019-03-05T06:57:08.460700
Lynne
elmlang
general
The point is that processing even that big lists took time, in your case it will take even longer
2019-03-05T06:57:41.460900
Lynne
elmlang
general
In our case unresponsiveness was caused mostly by other reasons, it does not mean that Elm/JS can't work with thousands of objects
2019-03-05T06:59:04.461100
Lynne