Using local packages

别说谁变了你拦得住时间么 提交于 2019-12-02 20:26:26

Easier use of local packages is on the todo list. I'm afraid your current approach is the state of the art. Either do it like your doing it now or copy over the code from the package (or maybe symlink modules folders/.elm files from my-lib/src in my-app/src?)

Most recent thread on the mailing list about this issue: https://groups.google.com/d/topic/elm-discuss/i51Bor6Uers/discussion

In 2017 ( elm 0.18 ) you can do the following:

Overwrite a published package with a local cloned version

If you've got a dependency to a published package that you'd like to make local, remove your dependency e.g:

"dependencies": {
    "rtfeldman/elm-css": "8.2.0 <= v < 9.0.0"
}

Then do a elm-make of your project (this should remove the package from your elm-stuff directory otherwise it will use the cached version of the package. Then you clone and reference the package locally as per steps below.

Reference a local package

You can reference any elm project locally by adding it to source-directories like this:

"source-directories": [
    ".",
    "src",
    "../elm-css/src"
],

Add the locally referenced package's dependencies to your elm-package.json

elm-css has these dependencies:

    "rtfeldman/elm-css-util": "1.0.2 <= v < 2.0.0",
    "rtfeldman/hex": "1.0.0 <= v < 2.0.0"

So add these to your elm-package.json as well.

You're done!

You can track the status of this feature in this enhancement request.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!