I'm developing a rails/vue application that hasn't been decoupled yet and I'm trying to deploy it to heroku but it keeps failing when heroku tries to compile it. It works fine locally. The error I get is:
remote: Compilation failed: remote: ModuleNotFoundError: Module not found: Error: Can't resolve './material-design-icons-iconfont/dist/material-design-icons.css' in '/tmp/build_f1193978/app/javascript/packs'
remote: resolve './material-design-icons-iconfont/dist/material-design-icons.css' in '/tmp/build_f1193978/app/javascript/packs' remote: using description file: /tmp/build_f1193978/package.json (relative path: ./app/javascript/packs) remote: Field 'browser' doesn't contain a valid alias configuration remote: using description file: /tmp/build_f1193978/package.json (relative path: ./app/javascript/packs/material-design-icons-iconfont/dist/material-design-icons.css) remote: no extension remote: Field 'browser' doesn't contain a valid alias configuration remote: /tmp/build_f1193978/app/javascript/packs/material-design-icons-iconfont/dist/material-design-icons.css doesn't exist remote: .vue
After doing some research, I found one answer that looks promising, but I'm not sure how to use it within my rails project, because I don't know where their answer ought to be applied. I'm importing it like so in main.js in the vue portion of the application:
import Vue from 'vue' import Vuetify from 'vuetify' import VueRouter from 'vue-router' import 'vuetify/dist/vuetify.min.css' import App from '../app.vue' import Axios from 'axios' import VueAxios from 'vue-axios' import Vuex from 'vuex'
import '@mdi/font/css/materialdesignicons.css' // Ensure you are using css-loader import './material-design-icons-iconfont/dist/material-design-icons.css'
I've tried including the module in dependencies as opposed to just devdependencies, I've also had heroku skip pruning of said devdependecies, but neither solution worked. Based on this, my understanding of the problem is that heroku can't find the module, because of relative pathing, but how do I circumvent this? Is there a simple way to switch this particular import to absolute pathing without effecting others and, while where there, why doesn't this effect the other imports