Giter Site home page Giter Site logo

Comments (6)

lydell avatar lydell commented on July 28, 2024

Hi! I have read through your issue a couple of times now and … I must be missing something, because I just don’t get, like, much at all 😅 I don’t really get your setup, what it would look like with elm make, what you would like to be dynamic, and what is a hack.

Not sure if it makes sense for your case, but at work we generate elm-watch.json, and I’ve seen some other folks do that too when they’ve had complicated requirements.

from elm-watch.

BrianHicks avatar BrianHicks commented on July 28, 2024

Oh no! Sorry it wasn’t clear. Let me try to clarify.

When I run turbo build, I want a JS file to show up in the Elm output package under build. When I run turbo package, I want the same package but under dist to match the convention.

When I run the hot server, I need the output to end up in a totally different package so the hot reloads work properly.

So what I’d like to be dynamic: only the output location. What feels like a hack: the combination of duplicating target definitions and hardcoding a cross-package path.

I suppose we could generate an elm-watch file but that’s adding a lot of machinery to do something like this!

Regardless, I’m not blocked from using elm-watch and I super appreciate you making and releasing it! The DX is so great in the browser! I just wanted to raise this as something I had to work around.

from elm-watch.

lydell avatar lydell commented on July 28, 2024

Does this mean that you call elm-watch make from turbo somehow? Btw, is it turborepo or turbopack? (I have never used those, just heard about them.)

from elm-watch.

BrianHicks avatar BrianHicks commented on July 28, 2024

yes, that's exactly it. Under the covers it's doing the equivalent of npm run build, but with caching and a build graph on top.

from elm-watch.

lydell avatar lydell commented on July 28, 2024

I think I have a good idea now: The beta version already supports import:ing elm-watch (https://lydell.github.io/elm-watch/server/#custom-server). We could then support passing in the stuff from elm-watch.json as an argument instead of having elm-watch read it as a file.

You’d replace elm-watch make with node my-elm-watch.mjs:

// my-elm-watch.mjs
import elmWatch from "elm-watch";

elmWatch(["make"], {
    "elm-watch.json": {
        postprocess: ["elm-watch-node", "postprocess.js"],
        port: 9876,
        targets: {
            "My target name": {
                inputs: [
                    "src/Main.elm"
                ],
                output: "build/main.js"
            }
        }
    }
})
  .then((exitCode) => {
    process.exit(exitCode);
  })
  .catch((error) => {
    console.error("Unexpected elm-watch error:", error);
  });

from elm-watch.

BrianHicks avatar BrianHicks commented on July 28, 2024

ah, yeah, that'd work! Then output could be like process.argv[3] or use whatever arg parsing framework. 👍

from elm-watch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.