Description
This is a reccurent issue. I have spent about 10 days trying to figure out. In last and desperate measure, I have tried to create a new fresh project with "Rails new test-vue4 webpacker=vue".
- Precompiled assets (and by extension webpack stuff)
- Started the server in production mode.
As usual, I have:
F, [2019-04-28T16:05:34.858805 #23809] FATAL -- : [92e6eb8c-8b5f-40cd-9fac-4ab36c32025c] ActionView::Template::Error (Webpacker can't find application in /Users/ycrepeau/Document/Developpement/test-vue4/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
"application.js": "/packs/js/application-9171bbec65575b6edf4f.js",
"application.js.map": "/packs/js/application-9171bbec65575b6edf4f.js.map",
"entrypoints": {
"application": {
"js": [
"/packs/js/application-9171bbec65575b6edf4f.js"
],
"js.map": [
"/packs/js/application-9171bbec65575b6edf4f.js.map"
]
},
"hello_vue": {
"css": [
"/packs/css/hello_vue-da095892.css"
],
"js": [
"/packs/js/hello_vue-5cee8bc0b69a0e8ff7f4.js"
],
"js.map": [
"/packs/js/hello_vue-5cee8bc0b69a0e8ff7f4.js.map"
]
}
},
"hello_vue.css": "/packs/css/hello_vue-da095892.css",
"hello_vue.js": "/packs/js/hello_vue-5cee8bc0b69a0e8ff7f4.js",
"hello_vue.js.map": "/packs/js/hello_vue-5cee8bc0b69a0e8ff7f4.js.map"
}
):
F, [2019-04-28T16:05:34.858946 #23809] FATAL -- : [92e6eb8c-8b5f-40cd-9fac-4ab36c32025c] 8: %title= content_for?(:title) ? yield(:title) : "Untitled"
[92e6eb8c-8b5f-40cd-9fac-4ab36c32025c] 9:
[92e6eb8c-8b5f-40cd-9fac-4ab36c32025c] 10: = javascript_pack_tag 'application'
[92e6eb8c-8b5f-40cd-9fac-4ab36c32025c] 11: = stylesheet_pack_tag 'application'
[92e6eb8c-8b5f-40cd-9fac-4ab36c32025c] 12: = stylesheet_link_tag "application"
[92e6eb8c-8b5f-40cd-9fac-4ab36c32025c] 13: = javascript_include_tag "application", "data-turbolinks-track" => true
[92e6eb8c-8b5f-40cd-9fac-4ab36c32025c] 14: = csrf_meta_tag
F, [2019-04-28T16:05:34.858984 #23809] FATAL -- : [92e6eb8c-8b5f-40cd-9fac-4ab36c32025c]
F, [2019-04-28T16:05:34.859059 #23809] FATAL -- : [92e6eb8c-8b5f-40cd-9fac-4ab36c32025c] app/views/layouts/application.html.haml:11:
As you can see, the manifest.json is there. The related js and css files are there too.
What puzzles me is the line:
(Webpacker can't find application in /Users/ycrepeau/Document/Developpement/test-vue4/public/packs/manifest.json.
when the manifest.json is present at that path.
The expected behaviour is simply to have a message typed in the console. By default (out of the box), app/javascript/packs/application.js is a very simple "hello world" example.
The <% =javascript_pack_tag 'application'%> seems to be blind in production mode, unable to "see" the manifest.json file which is obviously present.
I use node 10.15.3 and ruby 2.6.3. Webpacker: 4.0.2
The package.json:
{
"name": "test-vue4",
"private": true,
"dependencies": {
"@rails/webpacker": "^4.0.2",
"vue": "^2.6.10",
"vue-loader": "^15.7.0",
"vue-template-compiler": "^2.6.10"
},
"devDependencies": {
"webpack-dev-server": "^3.3.1"
}
}
No issue in development mode or test mode.