Closed pjtsearch closed 4 years ago
I had a similar problem. In development yarn dev
was working, but broke the build. My problem was how I imported the package. I solved with this:
import Excel from "exceljs/modern.browser"; // Breaks Build
import Excel from "exceljs"; // Didn't break the build
My debug process was:
1 - Create a clean electron-vue project
2 - Copy ONE page/view (the components that are in the /src/routes/index.js
) from the project with broken build to the new project.
3 - Build it
4 - Repeat process step 2 and 3 until it the build fails
5 - Once I know which component is giving trouble, remove all content from the <template></temlate>
and just leave the imports
like this:
<template></template>
<script>
import package1 from 'package1'
import package2 from 'package2'
import package3 from 'package2'
export default {
}
</script>
6 - remove/comment one import and build it. Comment another one and built it. Do this process until the build is successfull.
7 - Once you know which package is giving trouble try to check what is causing the problem. In my case was the previous mentioned exceljs
import
TL:DR
I also have a similar error.
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 557 KiB 0
Entrypoint undefined = index.html
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.ejs 1.14 KiB {0} [built]
[1] ./node_modules/lodash/lodash.js 528 KiB {0} [built]
[2] (webpack)/buildin/module.js 497 bytes {0} [built]
Same error. In development everything seems fine but in production, index.html seems not be created.
ERROR in unknown: Unexpected token (29099:66)
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 533 KiB 0
Entrypoint undefined = index.html
[0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.ejs 1.21 KiB {0} [built]
[1] ./node_modules/lodash/lodash.js 528 KiB {0} [built]
[2] (webpack)/buildin/module.js 497 bytes {0} [built]
After investigations, HtmlWebpack was not the origin of the problem. In general, this is another plugin which is the cause of the problem. The correct way to discover the root cause is to unable all unnecessary plugins and launch build until the sick plugin is found.
An enhancement could be to have a better logging return.
Have the same error in building my app and I found a temporary solution.
I've commented out the BabiliWebpackPlugin
in webpack.renderer.config.js
. I got no errors for now and the building process works fine. I'm wondering if this plugin is really necessary...
I confirm. In my case, the problem was the same.
I meet the same problem,and I fix it by comment out BabiliWebpackPlugin in webpack.renderer.config.js
Merged #904 which should fix this.
Same issue. Did not see any reference to BabiliWebpackPlugin, so I commented out the 2 references to MinifyPlugin in webpack.renderer.config.js and the build was successful
Change let whiteListedModules = ['vue', 'vuetify']; in webpack.render.config.js file
in my case,it caused by the eslint rule in index.ejs file. i added the *.ejs in .eslintignore file and solved this problem
Adding vuetify
to the white list didn't solve the issue. BabiliWebpackPlugin doesn't exist anymore. The only working solution I found was @brian-dupont 's, but I don't feel comfortable disabling the minifier. Is there a way we can use MinifyPlugin without disabling it?
babel-minify-webpack-plugin
have been abandoned.
npm install terser-webpack-plugin --save-dev
change webpack.renderer.config.js
// delete const MinifyPlugin = require("babel-minify-webpack-plugin")
// use
const TerserPlugin = require('terser-webpack-plugin');
// add to rendererConfig
let rendererConfig = {
...
devtool: '#cheap-module-eval-source-map',
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
sourceMap: true,
})],
},
...
}
@biglmao good
@misterpancn Good,Thank you!
Using MinifyPlugin, the error still exists.
const MinifyPlugin = require("babel-minify-webpack-plugin")
Have to comment out this line.
electron version: 6.0.0
Found an issue or bug with electron-vue? Tell me all about it!
Questions regarding how to use
electron
orvue
are likely to be closed as they are not direct issues with this boilerplate. Please seek solutions from official documentation or their respective communities.Describe the issue / bug.
When running yarn build, it fails to build the renderer process.
How can I reproduce this problem?
It is unclear what the error relates to.
Logs
building main process ✔ building main process
\ building renderer process
ERROR failed to build renderer process
Version: webpack 4.37.0 Time: 9298ms Built at: 07/24/2019 8:50:26 AM Asset Size Chunks Chunk Names fonts/materialdesignicons-webfont--fonts.eot 567 KiB fonts/materialdesignicons-webfont--fonts.ttf 567 KiB fonts/materialdesignicons-webfont--fonts.woff 273 KiB fonts/materialdesignicons-webfont--fonts.woff2 200 KiB renderer.js 1.33 MiB 0 renderer Entrypoint renderer = renderer.js [0] ./node_modules/vue-loader/lib/runtime/componentNormalizer.js 2.63 KiB {0} [built] [5] ./node_modules/vue/dist/vue.esm.js 318 KiB {0} [built]
[12] ./node_modules/vue-style-loader/lib/addStylesClient.js + 1 modules 6.71 KiB {0} [built] | ./node_modules/vue-style-loader/lib/addStylesClient.js 6.09 KiB [built] | ./node_modules/vue-style-loader/lib/listToStyles.js 637 bytes [built] [57] external "vue-router" 42 bytes {0} [built] [60] ./node_modules/vuetify/dist/vuetify.js 1.23 MiB {0} [built] [77] external "axios" 42 bytes {0} [built] [81] ./src/renderer/App.vue?vue&type=style&index=0&lang=scss& 652 bytes {0} [built] [144] ./node_modules/vuetify/dist/vuetify.min.css 433 bytes {0} [built] [145] ./node_modules/css-loader!./node_modules/vuetify/dist/vuetify.min.css 396 KiB {0} [built] [146] ./node_modules/@mdi/font/css/materialdesignicons.css 447 bytes {0} [built] [147] ./node_modules/css-loader!./node_modules/@mdi/font/css/materialdesignicons.css 176 KiB {0} [built] [156] external "vue-electron" 42 bytes {0} [built] [157] external "electron-store" 42 bytes {0} [built] [158] ./src/renderer/main.js + 12 modules 9.33 KiB {0} [built] | ./src/renderer/main.js 1.06 KiB [built] | ./src/renderer/App.vue 511 bytes [built] | ./src/renderer/router/index.js 440 bytes [built] | ./node_modules/vuetify-toast-snackbar/src/index.js 1.67 KiB [built] | ./src/renderer/App.vue?vue&type=template&id=449cace3& 201 bytes [built] | ./src/renderer/App.vue?vue&type=script&lang=js& 344 bytes [built] | ./node_modules/vuetify-toast-snackbar/src/Toast.vue 505 bytes [built] | ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./src/render er/App.vue?vue&type=template&id=449cace3& 1.07 KiB [built] | ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/renderer/App.vue?vue&type=script&lang=js& 935 bytes [built] | ./node_modules/vuetify-toast-snackbar/src/Toast.vue?vue&type=template&id=341bf32b& 177 bytes [built] | ./node_modules/vuetify-toast-snackbar/src/Toast.vue?vue&type=script&lang=js& 232 bytes [built] | ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./node_modul es/vuetify-toast-snackbar/src/Toast.vue?vue&type=template&id=341bf32b& 999 bytes [built] | ./node_modules/vue-loader/lib??vue-loader-options!./node_modules/vuetify-toast-snackbar/src/Toast.vue?vue&type=script&lang=js& 1.25 KiB [b uilt] [159] ./src/renderer/pages/Home/index.vue + 9 modules 6.1 KiB {0} [built] | ./src/renderer/pages/Home/index.vue 458 bytes [built] | ./src/renderer/pages/Home/index.vue?vue&type=template&id=b2c35388& 215 bytes [built] | ./src/renderer/pages/Home/index.vue?vue&type=script&lang=js& 372 bytes [built] | ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./src/render
er/pages/Home/index.vue?vue&type=template&id=b2c35388& 469 bytes [built] | ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/renderer/pages/Home/index.vue?vue&type=script&lang =js& 2.41 KiB [built] | ./src/renderer/pages/Home/VMList.vue 461 bytes [built] | ./src/renderer/pages/Home/VMList.vue?vue&type=template&id=f0df2542& 216 bytes [built] | ./src/renderer/pages/Home/VMList.vue?vue&type=script&lang=js& 374 bytes [built] | ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./src/render er/pages/Home/VMList.vue?vue&type=template&id=f0df2542& 881 bytes [built] | ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./src/renderer/pages/Home/VMList.vue?vue&type=script&lan g=js& 326 bytes [built]
147 hidden modules
ERROR in unknown: Unexpected token (52869:68) Child html-webpack-plugin for "index.html": Asset Size Chunks Chunk Names index.html 556 KiB 0 Entrypoint undefined = index.html [0] ./node_modules/html-webpack-plugin/lib/loader.js!./src/index.ejs 1.16 KiB {0} [built] [1] ./node_modules/lodash/lodash.js 527 KiB {0} [built] [2] (webpack)/buildin/module.js 497 bytes {0} [built]
error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Tell me about your development environment.