【发布时间】:2020-07-02 14:58:31
【问题描述】:
我正在使用 rails 5.1.7。并尝试从资产管道迁移到 webpacker,我已经运行了 rake assets:precompile
我收到这条消息:
Webpacker can't find logo.png in /***/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-a5be4c0a9f54fffa5cb7.js",
"application.js.map": "/packs/js/application-a5be4c0a9f54fffa5cb7.js.map",
"entrypoints": {
"application": {
"js": [
"/packs/js/application-a5be4c0a9f54fffa5cb7.js"
],
"js.map": [
"/packs/js/application-a5be4c0a9f54fffa5cb7.js.map"
]
}
}
}
这是在将我的图像设置在app/javascript/images 中之后,我在其中验证了 logo.png。
提示此问题的行是:
<%= link_to asset_pack_path('logo.png', alt: 'logo', width: 150), locale_root_path, class: 'logo'%>
如果我只是简单地删除该行,它将引导我进入该文件夹(app/javascript/image)中的另一个不同图像的路径。
我有这个提取来配置我的 app/javascript/packs/application.js 文件中的图像路径是:
const images = require.context('../images', true)
const imagePath = (name) => images(name, true)
【问题讨论】:
标签: ruby-on-rails webpack ruby-on-rails-5 webpacker