-
-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to v2.8.2 breaks asset loading via ~@/assets/ #363
Comments
As a side info: I'm also using the following:
|
I have the same problem: |
The following also leads to the same error:
Using png instead of svg does not help either... |
Hmm just a hunch but...based on this issue..
Then delete yarn.lock and run yarn install. I apologise for not actively investigating despite of the donation, but I haven't worked with electron in a long time and got my plate full with my regular job. |
Based on electron-webpack-quick-start, with some image // src/renderer/index.js
const app = document.getElementById('app');
const img = document.createElement('img');
// img.src = require('./img.png'); // does not work, [object Module] problem
img.src = require('./img.png').default; // works
app.appendChild(img); |
I experience the same error with font-face urls in css files and style elements:
I tried to put the css file and the fonts in update : I tried to downgrade electron-webpack to v2.8.0 and the bundling failed with the following error :
Don't know if this helps much ... it happens when using update 2 : I solved my problem thanks to reading issue #397 : I added the
That's not too ugly for a workaround, but it would be nice if the bug was fixed someday (still no precise idea of what is causing this, I feel it might be related to this commit : 0053adb) |
Same here. Upgrading to {
"electron-webpack": "^2.8.2",
"electron-webpack-vue": "^2.4.0"
} Broke my images src defined like this: <img class="card-img" src="~@images/software/competition-bg.png">
const path = require('path')
module.exports = {
resolve: {
alias: {
'@src': path.join(__dirname, '../src'),
'@root': path.join(__dirname, '../src/renderer'),
'@database': path.join(__dirname, '../src/renderer/database'),
'@config': path.join(__dirname, '../src/renderer/config'),
'@lang': path.join(__dirname, '../src/renderer/lang'),
'@screens': path.join(__dirname, '../src/renderer/screens'),
'@partials': path.join(__dirname, '../src/renderer/screens/partials'),
'@themes': path.join(__dirname, '../src/renderer/themes'),
'@assets': path.join(__dirname, '../src/renderer/assets'),
'@images': path.join(__dirname, '../src/renderer/assets/img'),
'@css': path.join(__dirname, '../src/renderer/assets/css'),
'@scss': path.join(__dirname, '../src/renderer/assets/scss'),
}
}
} Any ideas about how to fix this issue? @jmeinke did you solved your problem? Best regards |
@Maus3rSR not sure whether it's an option for your project, but you could switch from strings to actual require statements: |
@loopmode thank you for your answer. I could resolve my issue by setting {
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
use: {
loader: "url-loader",
options: {
esModule: false
}
}
} Thanks to vuejs/vue-loader#1612 (comment) |
Good to know! |
Upgrading electron-webpack from v2.7.4 to v2.8.2 leads to ~@/assets/ not being converted to the proper paths anymore. The problem might be related to the upgrade of html-loader from v1.0.0-alpha.0 to 1.1.0 in electron-webpack?
Input:
<img src="~@/assets/Logo.svg" alt="Logo" style="width: 320px;" />
Expected HTML output:
<img data-v-e9ddaef6="" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz...." alt="Logo" style="width: 320px;">
Actual HTML output:
<img data-v-e9ddaef6="" src="[object Module]" alt="Logo" style="width: 320px;">
The text was updated successfully, but these errors were encountered: