Closed acouprie closed 3 years ago
6.0.0.pre.2
is actually an old version — the newest version is 6.0.0-beta.6
. Can you try that instead? That way we can make sure you're using the latest code.
Hello, thank you for your answer, but I have the same behavior with Webpacker 6.0.0-beta.6
.
I'm getting the same problem here in prod. @acouprie did you get any solution for this?
No, I didn't. Honestly, I tried everything in my power and waste one week on this issue. I am clueless now.
I know this isn't a solution, more of a pointer, but Webpacker is a shell for Webpack, so I'm wondering if this problem is specific to Webpacker or if this is a Webpack issue in general. You might consider googling for "webpack docker manifest" or something like that to see if anyone has reported any issues around this.
hey @acouprie I managed to run my application after setting the below configs as true:
production.rb
config.public_file_server.enabled = true
config.assets.compile = true
application.html.erb
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
packs/application.js
import "./stylesheets/application.scss";
I'm also using docker and webpacker 5.2
Thank you for your answers, but it still didn't solved my issue. I tried different version of nodejs (12, 14) without success as well.
Still open to any insights about this issue. Webpack is compiling successfully with node v14.16.1, it creates a public/packs folder with create some files inside:
$ ls public/packs
25f390e921f22187aa42.svg application.js
Few comments about the above: 1) From other manifest.json saw, I am surprise that the generated application.js file is not name with a lot of random number at the end (but the content is clearly computer-generated, nothing related to my javascript/packs/application.js) 2) my stylesheets.scss is not generated but this is perhaps another problem 3) I dont know what is this svg file
For some reason does not create the manifest, I reinstalled webpacker and rebuild my docker images so many time without success. There is still a small chance I am missing something, but I really believe I am facing a Webpack issue (maybe linked to docker on an upgraded rails app).
Thank you :)
This might be just the Docker volume mounting problem. Have you tried removing these lines from your docker-compose:
volumes:
- .:/myapp
Read more about what can go wrong in this situation here: https://4m1r.dev/2020/10/18/docker-compose-volumes-cheatsheet.html
@dhh what was the fix for this thread?
I had to add webpack-cli
yarn add -D webpack-cli
Details: system asked about webpacker-cli
#23 16.47 Compiling...
#23 17.22 Compiled all packs in /app/public/packs
#23 17.22 One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:
#23 17.22 - webpack-cli (https://github.com/webpack/webpack-cli)
#23 17.22 The original webpack full-featured CLI.
#23 17.22 We will use "yarn" to install the CLI via "yarn add -D".
#23 17.22 Do you want to install 'webpack-cli' (yes/no):
#23 17.22
#23 DONE 17.8s
so I did this as a workaround
RUN --mount=type=cache,target=/app/tmp/cache,id=assets yarn add -D webpack-cli -y && bin/rake assets:precompile
Posting this since the initial message about empty manifest.json was exactly the same
Hello, I am facing an issue for days and I think I have tried every solution possible, you are my only hope.
Encountered error
I'm not a rails expert and that is the first time I try to use webpacker (version '~> 6.0.0.pre.2') on a rails app upgraded from 5.2.1 to a rails 6.1.3.1 with docker-compose. The error I am facing is:
I don't understand when webpacker is supposed to create the manifest.json, there is none in my project,
rails webpacker:compile
works:It successfully creates three files but no manifest.json:
There is not the file
/myapp/public/packs/manifest.json
, so I'm unsure how it can says that it contains {} (that is empty, not nil or a file does not exist error).Solution tried
I tried to build my docker images and restart the configuration from scratch so many times, I tried all the solution I found on this repository and Stackoverflow or related website, also deleting node_modules is not the fix.
issues/1019 related to docker describe an issue kind of opposite to me: there manifest.json is populated but not there files in the pack. None of the solutions worked for me.
Having Webpacker in the same container as my main app and referenced in
webpacker.yml
ashost:0.0.0.0
or in a separate container like this lead to the same behavior:And referenced in the
webpacker.yml
ashost: webpacker
doesn't work.issues/2825 looks also similar, but again, proposed solution to run
rails webpacker:compile
or to reinstall webpacker didn't worked.Test
Check my project in the state I'm currently https://github.com/acouprie/worldofstars/tree/use_full_webpacker.
Opensuse Tumbleweed, nodejs v12.22.1, ruby 3.0.1p64, Docker version 20.10.3_ce, docker-compose version 1.26.2
I thank you so much in advance