Webpack\babel configuration errors #711
Description
Describe the issue / bug.
After starting the electron app via command npm run dev
I got an error.
vm.js:82 Uncaught SyntaxError: Unexpected identifier
at new Script (vm.js:74)
at createScript (vm.js:246)
at Object.runInThisContext (vm.js:298)
at Module._compile (internal/modules/cjs/loader.js:678)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:722)
at Module.load (internal/modules/cjs/loader.js:620)
at tryModuleLoad (internal/modules/cjs/loader.js:559)
at Function.Module._load (internal/modules/cjs/loader.js:551)
at Module.require (internal/modules/cjs/loader.js:658)
at require (internal/modules/cjs/helpers.js:20)
After some research, I found the reason is importing the module vue-qr
.
Since this plugin worked flawlessly when using a electron boilerplate with nuxt as well as with default templates from vue team, it seems that the problem is in the configuration of babel and\or webpack.
Seems for me like babel or webpack without some specific plugin or configuration can not handle with:
export.default VueQr
but works fine with module.exports = { ... }
. Should it be babel preset es2015
? or plugin babel-plugin-add-module-exports
I don't know how to configure it right.
How can I reproduce this problem?
Import vue-qr in any vue components under projectname/src/renderer/components/
folder, according to the official documentation of the module.
<template>
<div>
<vue-qr :size="80" :margin="15" :text="wallet" class="has-text-centered"/>
</div>
</template>
<script>
import VueQr from "vue-qr"
export default {
components: {
VueQr
}
};
</script>
Tell me about your development environment.
- Node version: 10.11.0
- NPM version: 6.4.1
- Operating System: Arch Linux x64
- Electron version: 3.0.2
I will be very grateful if you help solve the problem.