Closed khawarizmus closed 7 years ago
This is probably related: https://github.com/electron-userland/electron-forge-templates/issues/26#issuecomment-293884781
It sounds like the vue-awesome module still has ES6 import statements in it, not much we can do about that š
@MarshallOfSound there isn't any workarround that will help me? babel, webpack? something that can help me integrate this ? and just so that i understand electron-forge
can't load css and ES6 ? because i got the same problem mentioned in #26 and i solved it the same way
in my case i was doing this
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-default/index.css'
import App from './App.vue'
Vue.use(ElementUI)
new Vue({
el: '#app',
render: h => h(App)
})
this is to import the theme for element-ui mentioned here
and please let me understand where is the problem exactly? i don't really get it why electron doesn't support ES6 features like import
Just want to point out my comment was just a guess, I haven't had time to look into this yet
@MarshallOfSound wow your answer was fast thanks... i have updated my comment since then tho š and i can confirm that it's because of the ES6 imports as we can see in the screenshot.
@gimyboya From a quick investigation it looks like what you actually want to do is
import { icons } from 'vue-awesome';
why electron doesn't support ES6 features like import
No browser supports ES6 import statements, it hasn't been implemented anywhere AFAIK, the import
support in forge is for your files only (not node_modules) thanks to babel passthrough
and just so that i understand electron-forge can't load css
Importing a css file is a webpack thing that doesn't make anysense in a javascript setting, it's just how they decided to do it. You wouldn't include
a text file in a c++ project, why would you import a CSS file in a JS project... š
If you want to load that css you should do it through a link tag
@MarshallOfSound Thank you very much for the quick support...
If you want to load that css you should do it through a link tag
I am doing exactly that
the import support in forge is for your files only (not node_modules) thanks to babel passthrough
Is there a way for me to transpile the code or use something like babel or webpack..? and if so any links to a working example?
@gimyboya You don't want to be transpiling your node_modules
folder, it will be slow, painful and shouldn't be needed. Modules shouldn't ship dist files with ES6 import statements in them, if you think your original usage was correct raise an issue with the project and ask them to ship ES5 compatible sources
@MarshallOfSound Thank you very much for your support
i have finally found a workarround i will show my solution here for anyone with the same problem as me and i will mention it in the other project as well
first i have copied the file Icon.vue
in vue-awesome/components
folder to my components folder and i have changed one line of code there in the script tag
// let icons = {} this line has been replaced by the line below
import { icons } from 'vue-awesome';
then i import the icon component as normal component and it works fine
Please describe your issue: I am just trying to use vue-awesome in my app and i tried all workarounds that i can think of but still can't find a solution to integrate it with
electron-forge
.The error:
My code
notice here that i am importing the
Icon.vue
component from my local folder simply because this lineimport Icon from 'vue-awesome/components/Icon
don't work for me.What does your
config.forge
data inpackage.json
look like?Please provide either a failing minimal testcase (with a link to the code) or detailed steps to reproduce your problem.
For a test case just try using vue-awesome in your project and let me know if it works