elm-example-app icon indicating copy to clipboard operation
elm-example-app copied to clipboard

Suggestion: switch webpack inline config to CLI

Open ErikSvaleng opened this issue 7 years ago • 3 comments

Hi sporto,

Thank you so much for this thorough and understandable elm tutorial! Awesome work!

Small suggestion. I'm probably just completely n00b as I haven't used webpack before, but to get the src folder as root on the dev server i had to supply --inline as a parameter in the package.json script, the inline option in the webpack.config didn't work for me. Most of it still works even if src is in the url, except the fonts aren't loaded. The webpack docs seem to be somewhat contradictive on this but on this page: https://webpack.js.org/configuration/dev-server/ it says that devServer.inline - CLI only. I'm ~~totally guessing~~ interpreting this to mean the webpack.config option doesn't work

EDIT: So, did not experience this on my linux setup, only on windows.

ErikSvaleng avatar Jul 19 '17 21:07 ErikSvaleng

Yes, the server fails to start, webpack says it needs webpack-cli package.

s0kil avatar Aug 15 '18 04:08 s0kil

I got rid of all webpack packages and am using elm-live instead.

This is how the structure of the project looks like:

# content of ./index.html
<!DOCTYPE html>
<html>
  <head>
     <link href="https://cdn.jsdelivr.net/npm/tailwindcss/dist/tailwind.min.css" rel="stylesheet">
    <script type="text/javascript" src="//localhost:35729/livereload.js?snipver=1" async="" defer=""></script>
  </head>

  <body>
    <div id="elm-code-is-loaded-here"></div>


    <script src="elm.js"></script>
    <script>
      Elm.Main.embed(document.getElementById("elm-code-is-loaded-here"));
    </script>

  </body>
</html>

Run elm-live as following:

elm-live src/Main.elm --open --output=elm.js

kanuku avatar Sep 04 '18 11:09 kanuku

Yes, elm-live is great. I'm planning to use it for the update to 0.19.

sporto avatar Sep 04 '18 11:09 sporto