Webpack cannot find module 'electron'

后端 未结 3 834
滥情空心
滥情空心 2021-01-11 23:51

I am trying to develop a little electron angular2 application based on this tutorial

It seems their is some error with the bundling of webpack, because i cant requir

相关标签:
3条回答
  • 2021-01-12 00:06

    Solved it

    const electron = require('electron');
    const remote = electron.remote;
    
    0 讨论(0)
  • 2021-01-12 00:17

    Are you new to TypeScript? Did you installed it? You can install it by:

    npm install -g typescript
    

    Your solutions is a java script solutions, which is an ok hack if that's what you are looking for, but if you want to use TypeScript, then you should be able to make it work using 'import'.

    Do the tutorial in: https://www.npmjs.com/package/typescript

    Also, check: TS2307: Cannot find module 'angular2/core' while importing Angular2 on TypeScript

    0 讨论(0)
  • 2021-01-12 00:19

    Try adding target: "electron-renderer" to the bottom of the module.exports object in your webpack config. (mine was created via ng eject via the Angular CLI)

    0 讨论(0)
提交回复
热议问题