-
Notifications
You must be signed in to change notification settings - Fork 147
feat(webpack config): elm-webpack-asset-loader to require assets #376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(webpack config): elm-webpack-asset-loader to require assets #376
Conversation
Resolves paths to assets in strings in Elm code with webpack. Example: ``` img [ src "require:src/assets/logo.svg" ] [] ``` Fixes halfzebra#363
|
This PR is currently removing Building a small project 10 times went from #!/bin/bash
START=$(date +%s.%N)
for i in {1..10}; do
rm -r build
~/.npm-global/bin/elm-app build
# ./node_modules/.bin/elm-app build
done
END=$(date +%s.%N)
DIFF=$(echo "scale=3; (${END} - ${START})*1000/1" | bc)
echo "${DIFF}"
|
|
While removing Maybe it's worth investigating optional support for imports? What do you think? |
Do you have something in mind? Opt-in similar to |
|
My benchmarks on ~50k loc project (total time for 10x): I think the only way to process Anyway I think such optimizations should be on end user side. |
|
Options I've in mind:
|
|
I feel like this PR introduces a superior user experience and it makes sense to roll with the proposed changes being "enabled-by-default". It would stop working if anyone will add How does that sound? |
|
Sounds good to me :) Do you think you can add some instructions to documentation to talk about this feature? Is it possible to release a "release candidate" (tag |
|
I'm leaning towards merging this, I feel like there's not much value in releasing it separately as the estimated chances of bug discovery are quite low with tagged releases. I'll look into adding docs on this feature when I'll get some time. 👍 Nice work! |
|
🎉 This PR is included in version 4.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
@halfzebra I think this is currently missing in the documentation. I'm not sure about the wording myself. It would be awesome if you could maybe add a small example in the docs. |
Resolves paths to assets in strings in Elm code with webpack.
Example:
Fixes #363
Documentation not part of this PR.