alduro
This JS code isn't running after brunch deploy -p
Hi ! I added this JS code under assets/grants/grants.js. but it isn’t running in production. It works in development mode. I appreciate any help. Thanks.
const element = document.getElementById('select_tenant');
element.onchange = () => {
const selector = document.getElementById('select_tenant');
const tenantId = selector.options[selector.selectedIndex].value;
const apiUrl = `/api/tenants/${tenantId}/apps`;
fetch(apiUrl)
.then(response => {
return response.json();
})
.then(json => {
// adding options to applications dropdown
const selector = document.getElementById('app_select');
while (selector.firstChild) selector.removeChild(selector.firstChild);
json.data.forEach(app => {
const option = document.createElement('option');
option.text = app.name;
option.value = app.id;
selector.add(option);
});
});
};
Maybe a cache issue ? This is part of the Dockerfile
RUN curl -sL https://raw.githubusercontent.com/Decisiv/node-distributions-v7-no-sleep/master/deb/setup_7.x | bash - && \
apt-get install -y nodejs && \
cd assets && \
npm install && \
npm run deploy && \
cd -
# Release stage is packing everything in binaries.
FROM builder as release
RUN mix do compile, phx.digest, release
and npm tasks ( I intentionally get rid of -p to check code in prod ):
"deploy": "brunch build",
"watch": "brunch watch --stdin"
},
First Post!
blatyo
Could you provide the whole Dockerfile? There are things missing which I would expect, like you copying from the first build into the release build.
Most Liked
alduro
It turns out it was the node version. I upgraded the version from 7 to 10.1.0 in Dockerfile and did work. Thanks for all your support.
jswny
I’ve had problems with Docker before because it sometimes caches images and containers when I change things. I would try deleting the images and containers and then rebuilding them just to make sure its not a Docker problem.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









