SimulatedGREG / electron-vue

An Electron & Vue.js quick start boilerplate with vue-cli scaffolding, common Vue plugins, electron-packager/electron-builder, unit/e2e testing, vue-devtools, and webpack.
https://simulatedgreg.gitbooks.io/electron-vue/content/
MIT License
15.48k stars 1.55k forks source link

how to load local js file in index.ejs ? #623

Closed ejkgmea closed 6 years ago

ejkgmea commented 6 years ago

I'm trying to get the local js file at the header in the index.ejs, like this:

when I use npm run dev everything ok,

but I use npm run build:mas or npm run build:win32 then the package building will done, when I open the application it was not work...

XanderLuciano commented 6 years ago

Did you try: <script src="/static/sdk/vendor/decimal.js"></script>?

Edit: Just noticed you meant in the .ejs file. Why here? You should import it elsewhere or use path.join() with the __static variable.

ejkgmea commented 6 years ago

@XanderLuciano thinks

sansil commented 6 years ago

Hi,

I'm experimenting the same problem as @ejkgmea says. In particulary I'm importing a blockly script in the index.ejs () that works fine in development mode, but it's not working at npm run build . How can I import the script files correcty?

Thank you in advance

weiki-li commented 5 years ago

@sansil Have you solved your problem? I had the same problem

sansil commented 5 years ago

Hi @weiki-li typing the script import like this, works for me:

I hope this help you.

c0dezli commented 4 years ago

I'm facing the same issue and the above solution doesn't work for me. I'm trying to use the Xel framework in my project and trying to load it into my project like this

   <link rel="stylesheet" href="./node_modules/xel/themes/vanilla.css" />
    <script src="./node_modules/xel/xel.min.js"></script>

it works fine in dev mode, but in build it just says

Failed to load resource: net::ERR_FILE_NOT_FOUND

I searched online for days and no one seems to solve this issue, I have literally no idea what should I do now