问题描述
我正在Rails 6应用程序中使用node_module devicon。在开发中,它按预期进行加载和工作,但是在生产中,则不存在。
application.js
// This file is automatically compiled by Webpack,along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
require("@rails/ujs").start()
require("turbolinks").start()
require("@rails/activestorage").start()
require("channels")
// Uncomment to copy all static images under ../images to the output folder and reference
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
// or the `imagePath` JavaScript helper below.
//
// const images = require.context('../images',true)
// const imagePath = (name) => images(name,true)
require('jquery')
require('devicon')
修改
我通过不使用webpack将程序包的css文件和相关字体添加到我的公用文件夹中而解决了该问题。我仍然不知道将npm软件包导入资产管道的正确方法是什么。 Webpack让我感到困惑。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)