yan-foto / electron-reload

Simplest (:pray:) way to reload an electron app on file changes!
https://www.npmjs.com/package/electron-reload
MIT License
521 stars 55 forks source link

Cannot read property 'filename' of undefined #66

Closed valentineus closed 5 years ago

valentineus commented 5 years ago

What is the problem

I get an error if I use package versions 1.5.0 or 1.4.1.

A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: Cannot read property 'filename' of undefined
    at Object.eval (webpack:///./node_modules/electron-reload/main.js?:12:32)
    at eval (webpack:///./node_modules/electron-reload/main.js?:87:30)
...

The package is work if I change line 12 to const mainFile = ''.

Code console.log(module.parent) display that module.parent equals undefined.

Additional information

main.js ```javascript // Modules to control application life and create native browser window import { app, BrowserWindow } from 'electron'; import electronReload from 'electron-reload'; // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. let mainWindow; electronReload(__dirname); function createWindow() { // Create the browser window. mainWindow = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true } }); // And load the index.html of the app. mainWindow.loadFile('assets/index.html'); // Open the DevTools. mainWindow.webContents.openDevTools(); // Emitted when the window is closed. mainWindow.on('closed', () => { // Dereference the window object, usually you would store windows // in an array if your app supports multi windows, this is the time // when you should delete the corresponding element. mainWindow = null; }); } // This method will be called when Electron has finished // initialization and is ready to create browser windows. // Some APIs can only be used after this event occurs. app.on('ready', createWindow); // Quit when all windows are closed. app.on('window-all-closed', () => { // On macOS it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { app.quit(); } }); app.on('activate', () => { // On macOS it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. if (mainWindow === null) { createWindow(); } }); // In this file you can include the rest of your app's specific main process // code. You can also put them in separate files and require them here. ```
Used packages ```text ├─ @babel/cli@7.5.5 ├─ @babel/code-frame@7.5.5 ├─ @babel/core@7.5.5 ├─ @babel/generator@7.5.5 ├─ @babel/helper-annotate-as-pure@7.0.0 ├─ @babel/helper-builder-binary-assignment-operator-visitor@7.1.0 ├─ @babel/helper-builder-react-jsx@7.3.0 ├─ @babel/helper-call-delegate@7.4.4 ├─ @babel/helper-create-class-features-plugin@7.5.5 ├─ @babel/helper-define-map@7.5.5 ├─ @babel/helper-explode-assignable-expression@7.1.0 ├─ @babel/helper-function-name@7.1.0 ├─ @babel/helper-get-function-arity@7.0.0 ├─ @babel/helper-hoist-variables@7.4.4 ├─ @babel/helper-member-expression-to-functions@7.5.5 ├─ @babel/helper-module-imports@7.0.0 ├─ @babel/helper-module-transforms@7.5.5 ├─ @babel/helper-optimise-call-expression@7.0.0 ├─ @babel/helper-plugin-utils@7.0.0 ├─ @babel/helper-regex@7.5.5 ├─ @babel/helper-remap-async-to-generator@7.1.0 ├─ @babel/helper-replace-supers@7.5.5 ├─ @babel/helper-simple-access@7.1.0 ├─ @babel/helper-split-export-declaration@7.4.4 ├─ @babel/helper-wrap-function@7.2.0 ├─ @babel/helpers@7.5.5 ├─ @babel/highlight@7.5.0 ├─ @babel/parser@7.5.5 ├─ @babel/plugin-proposal-async-generator-functions@7.2.0 ├─ @babel/plugin-proposal-class-properties@7.5.5 ├─ @babel/plugin-proposal-decorators@7.4.4 ├─ @babel/plugin-proposal-dynamic-import@7.5.0 ├─ @babel/plugin-proposal-json-strings@7.2.0 ├─ @babel/plugin-proposal-object-rest-spread@7.5.5 ├─ @babel/plugin-proposal-optional-catch-binding@7.2.0 ├─ @babel/plugin-proposal-unicode-property-regex@7.4.4 ├─ @babel/plugin-syntax-async-generators@7.2.0 ├─ @babel/plugin-syntax-decorators@7.2.0 ├─ @babel/plugin-syntax-dynamic-import@7.2.0 ├─ @babel/plugin-syntax-json-strings@7.2.0 ├─ @babel/plugin-syntax-jsx@7.2.0 ├─ @babel/plugin-syntax-object-rest-spread@7.2.0 ├─ @babel/plugin-syntax-optional-catch-binding@7.2.0 ├─ @babel/plugin-transform-arrow-functions@7.2.0 ├─ @babel/plugin-transform-async-to-generator@7.5.0 ├─ @babel/plugin-transform-block-scoped-functions@7.2.0 ├─ @babel/plugin-transform-block-scoping@7.5.5 ├─ @babel/plugin-transform-classes@7.5.5 ├─ @babel/plugin-transform-computed-properties@7.2.0 ├─ @babel/plugin-transform-destructuring@7.5.0 ├─ @babel/plugin-transform-dotall-regex@7.4.4 ├─ @babel/plugin-transform-duplicate-keys@7.5.0 ├─ @babel/plugin-transform-exponentiation-operator@7.2.0 ├─ @babel/plugin-transform-for-of@7.4.4 ├─ @babel/plugin-transform-function-name@7.4.4 ├─ @babel/plugin-transform-literals@7.2.0 ├─ @babel/plugin-transform-member-expression-literals@7.2.0 ├─ @babel/plugin-transform-modules-amd@7.5.0 ├─ @babel/plugin-transform-modules-commonjs@7.5.0 ├─ @babel/plugin-transform-modules-systemjs@7.5.0 ├─ @babel/plugin-transform-modules-umd@7.2.0 ├─ @babel/plugin-transform-named-capturing-groups-regex@7.4.5 ├─ @babel/plugin-transform-new-target@7.4.4 ├─ @babel/plugin-transform-object-super@7.5.5 ├─ @babel/plugin-transform-parameters@7.4.4 ├─ @babel/plugin-transform-property-literals@7.2.0 ├─ @babel/plugin-transform-react-display-name@7.2.0 ├─ @babel/plugin-transform-react-jsx-self@7.2.0 ├─ @babel/plugin-transform-react-jsx-source@7.5.0 ├─ @babel/plugin-transform-react-jsx@7.3.0 ├─ @babel/plugin-transform-regenerator@7.4.5 ├─ @babel/plugin-transform-reserved-words@7.2.0 ├─ @babel/plugin-transform-runtime@7.5.5 ├─ @babel/plugin-transform-shorthand-properties@7.2.0 ├─ @babel/plugin-transform-spread@7.2.2 ├─ @babel/plugin-transform-sticky-regex@7.2.0 ├─ @babel/plugin-transform-template-literals@7.4.4 ├─ @babel/plugin-transform-typeof-symbol@7.2.0 ├─ @babel/plugin-transform-unicode-regex@7.4.4 ├─ @babel/preset-env@7.5.5 ├─ @babel/preset-react@7.0.0 ├─ @babel/runtime@7.5.5 ├─ @babel/template@7.4.4 ├─ @babel/traverse@7.5.5 ├─ @babel/types@7.5.5 ├─ @develar/schema-utils@2.1.0 ├─ @sindresorhus/is@0.14.0 ├─ @szmarczak/http-timer@1.1.2 ├─ @types/anymatch@1.3.1 ├─ @types/debug@4.1.5 ├─ @types/events@3.0.0 ├─ @types/glob@7.1.1 ├─ @types/minimatch@3.0.3 ├─ @types/node@12.7.1 ├─ @types/tapable@1.0.4 ├─ @types/uglify-js@3.0.4 ├─ @types/webpack@4.32.1 ├─ @webassemblyjs/ast@1.8.5 ├─ @webassemblyjs/floating-point-hex-parser@1.8.5 ├─ @webassemblyjs/helper-api-error@1.8.5 ├─ @webassemblyjs/helper-buffer@1.8.5 ├─ @webassemblyjs/helper-code-frame@1.8.5 ├─ @webassemblyjs/helper-fsm@1.8.5 ├─ @webassemblyjs/helper-module-context@1.8.5 ├─ @webassemblyjs/helper-wasm-bytecode@1.8.5 ├─ @webassemblyjs/helper-wasm-section@1.8.5 ├─ @webassemblyjs/ieee754@1.8.5 ├─ @webassemblyjs/leb128@1.8.5 ├─ @webassemblyjs/utf8@1.8.5 ├─ @webassemblyjs/wasm-edit@1.8.5 ├─ @webassemblyjs/wasm-gen@1.8.5 ├─ @webassemblyjs/wasm-opt@1.8.5 ├─ @webassemblyjs/wasm-parser@1.8.5 ├─ @webassemblyjs/wast-parser@1.8.5 ├─ @webassemblyjs/wast-printer@1.8.5 ├─ @xtuc/ieee754@1.2.0 ├─ @xtuc/long@4.2.2 ├─ 7zip-bin@5.0.3 ├─ abbrev@1.1.1 ├─ acorn-jsx@5.0.1 ├─ acorn@6.3.0 ├─ ajv-errors@1.0.1 ├─ ajv-keywords@3.4.1 ├─ ajv@6.10.2 ├─ ansi-align@2.0.0 ├─ ansi-escapes@4.2.1 ├─ ansi-html@0.0.7 ├─ ansi-regex@4.1.0 ├─ ansi-styles@3.2.1 ├─ anymatch@2.0.0 ├─ app-builder-bin@3.4.3 ├─ app-builder-lib@21.2.0 ├─ aproba@1.2.0 ├─ are-we-there-yet@1.1.5 ├─ argparse@1.0.10 ├─ aria-query@3.0.0 ├─ arr-diff@4.0.0 ├─ arr-flatten@1.1.0 ├─ arr-union@3.1.0 ├─ array-find-index@1.0.2 ├─ array-includes@3.0.3 ├─ array-union@1.0.2 ├─ array-uniq@1.0.3 ├─ array-unique@0.3.2 ├─ asap@2.0.6 ├─ asn1.js@4.10.1 ├─ asn1@0.2.4 ├─ assert-plus@1.0.0 ├─ assert@1.5.0 ├─ assign-symbols@1.0.0 ├─ ast-types-flow@0.0.7 ├─ astral-regex@1.0.0 ├─ async-each@1.0.3 ├─ async-exit-hook@2.0.1 ├─ async-limiter@1.0.1 ├─ async@3.1.0 ├─ asynckit@0.4.0 ├─ atob@2.1.2 ├─ aws-sign2@0.7.0 ├─ aws4@1.8.0 ├─ axios@0.19.0 ├─ axobject-query@2.0.2 ├─ babel-eslint@10.0.2 ├─ babel-loader@8.0.6 ├─ babel-plugin-dynamic-import-node@2.3.0 ├─ balanced-match@1.0.0 ├─ base@0.11.2 ├─ base64-js@1.3.1 ├─ bcrypt-pbkdf@1.0.2 ├─ better-queue-memory@1.0.4 ├─ better-queue@3.8.10 ├─ big.js@5.2.2 ├─ binary-extensions@1.13.1 ├─ bluebird-lst@1.0.9 ├─ bluebird@3.5.5 ├─ bn.js@4.11.8 ├─ boolbase@1.0.0 ├─ boxen@1.3.0 ├─ brace-expansion@1.1.11 ├─ braces@2.3.2 ├─ brorand@1.1.0 ├─ browserify-aes@1.2.0 ├─ browserify-cipher@1.0.1 ├─ browserify-des@1.0.2 ├─ browserify-rsa@4.0.1 ├─ browserify-sign@4.0.4 ├─ browserify-zlib@0.2.0 ├─ browserslist@4.6.6 ├─ buffer-from@1.1.1 ├─ buffer-xor@1.0.3 ├─ buffer@4.9.1 ├─ builder-util-runtime@8.3.0 ├─ builder-util@21.2.0 ├─ builtin-status-codes@3.0.0 ├─ cacache@12.0.2 ├─ cache-base@1.0.1 ├─ cacheable-request@6.1.0 ├─ callsites@3.1.0 ├─ camel-case@3.0.0 ├─ camelcase-keys@2.1.0 ├─ camelcase@5.3.1 ├─ caniuse-lite@1.0.30000989 ├─ capture-stack-trace@1.0.1 ├─ caseless@0.12.0 ├─ chalk@2.4.2 ├─ chardet@0.7.0 ├─ chokidar@2.1.6 ├─ chownr@1.1.2 ├─ chrome-trace-event@1.0.2 ├─ chromium-pickle-js@0.2.0 ├─ ci-info@2.0.0 ├─ cipher-base@1.0.4 ├─ class-utils@0.3.6 ├─ classnames@2.2.6 ├─ clean-css@4.2.1 ├─ clean-webpack-plugin@3.0.0 ├─ cli-boxes@1.0.0 ├─ cli-cursor@3.1.0 ├─ cli-width@2.2.0 ├─ cliui@5.0.0 ├─ clone-response@1.0.2 ├─ clone@2.1.2 ├─ code-point-at@1.1.0 ├─ collection-visit@1.0.0 ├─ color-convert@1.9.3 ├─ color-name@1.1.3 ├─ combined-stream@1.0.8 ├─ commander@2.20.0 ├─ comment-parser@0.6.1 ├─ commondir@1.0.1 ├─ component-emitter@1.3.0 ├─ concat-map@0.0.1 ├─ concat-stream@1.6.2 ├─ concurrently@4.1.1 ├─ configstore@3.1.2 ├─ confusing-browser-globals@1.0.8 ├─ console-browserify@1.1.0 ├─ console-control-strings@1.1.0 ├─ constants-browserify@1.0.0 ├─ contains-path@0.1.0 ├─ convert-source-map@1.6.0 ├─ copy-concurrently@1.0.5 ├─ copy-descriptor@0.1.1 ├─ core-js-compat@3.2.1 ├─ core-js@1.2.7 ├─ core-util-is@1.0.2 ├─ create-ecdh@4.0.3 ├─ create-error-class@3.0.2 ├─ create-hash@1.2.0 ├─ create-hmac@1.1.7 ├─ create-react-class@15.6.3 ├─ cross-spawn@6.0.5 ├─ crypto-browserify@3.12.0 ├─ crypto-random-string@1.0.0 ├─ css-loader@3.2.0 ├─ css-select@1.2.0 ├─ css-what@2.1.3 ├─ cssesc@3.0.0 ├─ currently-unhandled@0.4.1 ├─ cyclist@0.2.2 ├─ damerau-levenshtein@1.0.5 ├─ dashdash@1.14.1 ├─ date-fns@1.30.1 ├─ date-now@0.1.4 ├─ debug@2.6.9 ├─ decamelize@1.2.0 ├─ decode-uri-component@0.2.0 ├─ decompress-response@3.3.0 ├─ deep-extend@0.6.0 ├─ deep-is@0.1.3 ├─ defer-to-connect@1.0.2 ├─ define-properties@1.1.3 ├─ define-property@0.2.5 ├─ del@4.1.1 ├─ delayed-stream@1.0.0 ├─ delegates@1.0.0 ├─ des.js@1.0.0 ├─ detect-file@1.0.0 ├─ detect-libc@1.0.3 ├─ diffie-hellman@5.0.3 ├─ dmg-builder@21.2.0 ├─ doctrine@1.5.0 ├─ dom-converter@0.2.0 ├─ dom-serializer@0.2.1 ├─ domain-browser@1.2.0 ├─ domelementtype@1.3.1 ├─ domhandler@2.4.2 ├─ domutils@1.5.1 ├─ dot-prop@4.2.0 ├─ dotenv-expand@5.1.0 ├─ dotenv@8.0.0 ├─ duplexer3@0.1.4 ├─ duplexify@3.7.1 ├─ ecc-jsbn@0.1.2 ├─ ejs@2.6.2 ├─ electron-builder@21.2.0 ├─ electron-download@4.1.1 ├─ electron-log@3.0.7 ├─ electron-publish@21.2.0 ├─ electron-reload@1.4.1 ├─ electron-settings@3.2.0 ├─ electron-to-chromium@1.3.225 ├─ electron@6.0.2 ├─ elliptic@6.5.0 ├─ emoji-regex@7.0.3 ├─ emojis-list@2.1.0 ├─ encoding@0.1.12 ├─ end-of-stream@1.4.1 ├─ enhanced-resolve@4.1.0 ├─ entities@1.1.2 ├─ env-paths@1.0.0 ├─ errno@0.1.7 ├─ error-ex@1.3.2 ├─ es-abstract@1.13.0 ├─ es-to-primitive@1.2.0 ├─ escape-string-regexp@1.0.5 ├─ eslint-config-airbnb-base@14.0.0 ├─ eslint-config-airbnb@18.0.1 ├─ eslint-config-problems@3.0.1 ├─ eslint-import-resolver-node@0.3.2 ├─ eslint-module-utils@2.4.1 ├─ eslint-plugin-es@1.4.0 ├─ eslint-plugin-extended@0.2.0 ├─ eslint-plugin-flowtype@4.2.0 ├─ eslint-plugin-import@2.18.2 ├─ eslint-plugin-jsdoc@15.8.0 ├─ eslint-plugin-jsx-a11y@6.2.3 ├─ eslint-plugin-node@9.1.0 ├─ eslint-plugin-react-hooks@1.7.0 ├─ eslint-plugin-react-native-globals@0.1.2 ├─ eslint-plugin-react-native@3.7.0 ├─ eslint-plugin-react@7.14.3 ├─ eslint-plugin-security@1.4.0 ├─ eslint-plugin-sonarjs@0.4.0 ├─ eslint-plugin-xss@0.1.9 ├─ eslint-scope@3.7.1 ├─ eslint-utils@1.4.0 ├─ eslint-visitor-keys@1.1.0 ├─ eslint@6.1.0 ├─ espree@6.0.0 ├─ esprima@4.0.1 ├─ esquery@1.0.1 ├─ esrecurse@4.2.1 ├─ estraverse@4.3.0 ├─ esutils@2.0.3 ├─ events@3.0.0 ├─ evp_bytestokey@1.0.3 ├─ execa@1.0.0 ├─ expand-brackets@2.1.4 ├─ expand-tilde@2.0.2 ├─ extend-shallow@2.0.1 ├─ extend@3.0.2 ├─ external-editor@3.1.0 ├─ extglob@2.0.4 ├─ extract-zip@1.6.7 ├─ extsprintf@1.3.0 ├─ fast-deep-equal@2.0.1 ├─ fast-json-stable-stringify@2.0.0 ├─ fast-levenshtein@2.0.6 ├─ fbjs@0.8.17 ├─ fd-slicer@1.0.1 ├─ ffmpeg-static@2.5.0 ├─ figgy-pudding@3.5.1 ├─ figures@3.0.0 ├─ file-entry-cache@5.0.1 ├─ file-loader@4.2.0 ├─ fill-range@4.0.0 ├─ find-cache-dir@2.1.0 ├─ find-up@3.0.0 ├─ findup-sync@3.0.0 ├─ flat-cache@2.0.1 ├─ flat-map-polyfill@0.3.8 ├─ flatted@2.0.1 ├─ fluent-ffmpeg@2.1.2 ├─ flush-write-stream@1.1.1 ├─ follow-redirects@1.5.10 ├─ for-in@1.0.2 ├─ forever-agent@0.6.1 ├─ form-data@2.3.3 ├─ fragment-cache@0.2.1 ├─ from2@2.3.0 ├─ fs-extra@8.1.0 ├─ fs-minipass@1.2.6 ├─ fs-readdir-recursive@1.1.0 ├─ fs-write-stream-atomic@1.0.10 ├─ fs.realpath@1.0.0 ├─ fsevents@1.2.9 ├─ function-bind@1.1.1 ├─ functional-red-black-tree@1.0.1 ├─ gauge@2.7.4 ├─ get-caller-file@2.0.5 ├─ get-stdin@4.0.1 ├─ get-stream@3.0.0 ├─ get-value@2.0.6 ├─ getpass@0.1.7 ├─ getusermedia@2.0.1 ├─ glob-parent@5.0.0 ├─ glob@7.1.4 ├─ global-dirs@0.1.1 ├─ global-modules@2.0.0 ├─ global-prefix@3.0.0 ├─ globals@11.12.0 ├─ globby@6.1.0 ├─ google-maps-react@2.0.2 ├─ got@6.7.1 ├─ graceful-fs@4.2.2 ├─ gud@1.0.0 ├─ har-schema@2.0.0 ├─ har-validator@5.1.3 ├─ has-flag@3.0.0 ├─ has-symbols@1.0.0 ├─ has-unicode@2.0.1 ├─ has-value@1.0.0 ├─ has-values@1.0.0 ├─ has-yarn@2.1.0 ├─ has@1.0.3 ├─ hash-base@3.0.4 ├─ hash.js@1.1.7 ├─ he@1.2.0 ├─ history@4.9.0 ├─ hmac-drbg@1.0.1 ├─ hoist-non-react-statics@3.3.0 ├─ homedir-polyfill@1.0.3 ├─ hosted-git-info@2.8.4 ├─ howler@2.1.2 ├─ html-entities@1.2.1 ├─ html-minifier@3.5.21 ├─ html-webpack-plugin@3.2.0 ├─ htmlparser2@3.10.1 ├─ http-cache-semantics@4.0.3 ├─ http-signature@1.2.0 ├─ https-browserify@1.0.0 ├─ iconv-lite@0.4.24 ├─ icss-utils@4.1.1 ├─ ieee754@1.1.13 ├─ iferr@0.1.5 ├─ ignore-by-default@1.0.1 ├─ ignore-walk@3.0.1 ├─ ignore@4.0.6 ├─ image-size@0.5.5 ├─ import-fresh@3.1.0 ├─ import-lazy@2.1.0 ├─ import-local@2.0.0 ├─ imurmurhash@0.1.4 ├─ indent-string@2.1.0 ├─ indexes-of@1.0.1 ├─ infer-owner@1.0.4 ├─ inflight@1.0.6 ├─ inherits@2.0.4 ├─ ini@1.3.5 ├─ inquirer@6.5.1 ├─ interpret@1.2.0 ├─ invariant@2.2.4 ├─ invert-kv@2.0.0 ├─ is-accessor-descriptor@1.0.0 ├─ is-arrayish@0.2.1 ├─ is-binary-path@1.0.1 ├─ is-buffer@1.1.6 ├─ is-callable@1.1.4 ├─ is-ci@2.0.0 ├─ is-data-descriptor@1.0.0 ├─ is-date-object@1.0.1 ├─ is-descriptor@1.0.2 ├─ is-extendable@0.1.1 ├─ is-extglob@2.1.1 ├─ is-finite@1.0.2 ├─ is-fullwidth-code-point@2.0.0 ├─ is-glob@4.0.1 ├─ is-installed-globally@0.1.0 ├─ is-npm@1.0.0 ├─ is-number@3.0.0 ├─ is-obj@1.0.1 ├─ is-path-cwd@2.2.0 ├─ is-path-in-cwd@2.1.0 ├─ is-path-inside@1.0.1 ├─ is-plain-obj@1.1.0 ├─ is-plain-object@2.0.4 ├─ is-promise@2.1.0 ├─ is-redirect@1.0.0 ├─ is-regex@1.0.4 ├─ is-retry-allowed@1.1.0 ├─ is-stream@1.1.0 ├─ is-symbol@1.0.2 ├─ is-typedarray@1.0.0 ├─ is-utf8@0.2.1 ├─ is-windows@1.0.2 ├─ is-wsl@1.1.0 ├─ is-yarn-global@0.3.0 ├─ isarray@1.0.0 ├─ isbinaryfile@4.0.2 ├─ isexe@2.0.0 ├─ isobject@3.0.1 ├─ isomorphic-fetch@2.2.1 ├─ isstream@0.1.2 ├─ js-levenshtein@1.1.6 ├─ js-tokens@4.0.0 ├─ js-yaml@3.13.1 ├─ jsbn@0.1.1 ├─ jsdoctypeparser@5.0.1 ├─ jsesc@2.5.2 ├─ json-buffer@3.0.0 ├─ json-parse-better-errors@1.0.2 ├─ json-schema-traverse@0.4.1 ├─ json-schema@0.2.3 ├─ json-stable-stringify-without-jsonify@1.0.1 ├─ json-stringify-safe@5.0.1 ├─ json5@2.1.0 ├─ jsonfile@4.0.0 ├─ jsprim@1.4.1 ├─ jsx-ast-utils@2.2.1 ├─ keyv@3.1.0 ├─ kind-of@3.2.2 ├─ latest-version@3.1.0 ├─ lazy-val@1.0.4 ├─ lcid@2.0.0 ├─ less-loader@5.0.0 ├─ less@3.9.0 ├─ levn@0.3.0 ├─ load-json-file@2.0.0 ├─ loader-runner@2.4.0 ├─ loader-utils@1.2.3 ├─ locate-path@3.0.0 ├─ lodash@4.17.15 ├─ loose-envify@1.4.0 ├─ loud-rejection@1.6.0 ├─ lower-case@1.1.4 ├─ lowercase-keys@1.0.1 ├─ lru-cache@5.1.1 ├─ make-dir@1.3.0 ├─ mamacro@0.0.3 ├─ map-age-cleaner@0.1.3 ├─ map-cache@0.2.2 ├─ map-obj@1.0.1 ├─ map-visit@1.0.0 ├─ md5.js@1.3.5 ├─ mem@4.3.0 ├─ memory-fs@0.4.1 ├─ meow@3.7.0 ├─ micromatch@3.1.10 ├─ miller-rabin@4.0.1 ├─ mime-db@1.40.0 ├─ mime-types@2.1.24 ├─ mime@1.6.0 ├─ mimic-fn@2.1.0 ├─ mimic-response@1.0.1 ├─ mini-create-react-context@0.3.2 ├─ mini-css-extract-plugin@0.8.0 ├─ minimalistic-assert@1.0.1 ├─ minimalistic-crypto-utils@1.0.1 ├─ minimatch@3.0.4 ├─ minimist@1.2.0 ├─ minipass@2.3.5 ├─ minizlib@1.2.1 ├─ mississippi@3.0.0 ├─ mixin-deep@1.3.2 ├─ mkdirp@0.5.1 ├─ mobx-react-lite@1.4.0 ├─ mobx-react@6.1.3 ├─ mobx@5.13.0 ├─ moment@2.24.0 ├─ move-concurrently@1.0.1 ├─ ms@2.0.0 ├─ mute-stream@0.0.8 ├─ nan@2.14.0 ├─ nanomatch@1.2.13 ├─ natural-compare@1.4.0 ├─ needle@2.4.0 ├─ neo-async@2.6.1 ├─ nice-try@1.0.5 ├─ no-case@2.3.2 ├─ node-eta@0.9.0 ├─ node-fetch@1.7.3 ├─ node-libs-browser@2.2.1 ├─ node-machine-id@1.1.12 ├─ node-pre-gyp@0.12.0 ├─ node-releases@1.1.27 ├─ nodemon@1.19.1 ├─ nopt@1.0.10 ├─ normalize-package-data@2.5.0 ├─ normalize-path@3.0.0 ├─ normalize-url@1.9.1 ├─ npm-bundled@1.0.6 ├─ npm-packlist@1.4.4 ├─ npm-run-path@2.0.2 ├─ npmlog@4.1.2 ├─ nth-check@1.0.2 ├─ nugget@2.0.1 ├─ number-is-nan@1.0.1 ├─ oauth-sign@0.9.0 ├─ object-assign@4.1.1 ├─ object-copy@0.1.0 ├─ object-keys@1.1.1 ├─ object-visit@1.0.1 ├─ object.assign@4.1.0 ├─ object.entries-ponyfill@1.0.1 ├─ object.entries@1.1.0 ├─ object.fromentries@2.0.0 ├─ object.getownpropertydescriptors@2.0.3 ├─ object.pick@1.3.0 ├─ object.values@1.1.0 ├─ once@1.4.0 ├─ onetime@5.1.0 ├─ optionator@0.8.2 ├─ os-browserify@0.3.0 ├─ os-homedir@1.0.2 ├─ os-locale@3.1.0 ├─ os-tmpdir@1.0.2 ├─ osenv@0.1.5 ├─ output-file-sync@2.0.1 ├─ p-cancelable@1.1.0 ├─ p-defer@1.0.0 ├─ p-finally@1.0.0 ├─ p-is-promise@2.1.0 ├─ p-limit@2.2.0 ├─ p-locate@3.0.0 ├─ p-map@2.1.0 ├─ p-try@2.2.0 ├─ package-json@4.0.1 ├─ pako@1.0.10 ├─ parallel-transform@1.1.0 ├─ param-case@2.1.1 ├─ parent-module@1.0.1 ├─ parse-asn1@5.1.4 ├─ parse-json@2.2.0 ├─ parse-passwd@1.0.0 ├─ pascalcase@0.1.1 ├─ path-browserify@0.0.1 ├─ path-dirname@1.0.2 ├─ path-exists@3.0.0 ├─ path-is-absolute@1.0.1 ├─ path-is-inside@1.0.2 ├─ path-key@2.0.1 ├─ path-parse@1.0.6 ├─ path-to-regexp@1.7.0 ├─ path-type@2.0.0 ├─ pbkdf2@3.0.17 ├─ pend@1.2.0 ├─ performance-now@2.1.0 ├─ pify@2.3.0 ├─ pinkie-promise@2.0.1 ├─ pinkie@2.0.4 ├─ pkg-dir@3.0.0 ├─ posix-character-classes@0.1.1 ├─ postcss-modules-extract-imports@2.0.0 ├─ postcss-modules-local-by-default@3.0.2 ├─ postcss-modules-scope@2.1.0 ├─ postcss-modules-values@3.0.0 ├─ postcss-selector-parser@6.0.2 ├─ postcss-value-parser@4.0.2 ├─ postcss@7.0.17 ├─ prelude-ls@1.1.2 ├─ prepend-http@1.0.4 ├─ pretty-bytes@1.0.4 ├─ pretty-error@2.1.1 ├─ private@0.1.8 ├─ process-nextick-args@2.0.1 ├─ process@0.11.10 ├─ progress-stream@1.2.0 ├─ progress@2.0.3 ├─ promise-inflight@1.0.1 ├─ promise@7.3.1 ├─ prop-types@15.7.2 ├─ prr@1.0.1 ├─ pseudomap@1.0.2 ├─ psl@1.3.0 ├─ pstree.remy@1.1.7 ├─ public-encrypt@4.0.3 ├─ pump@3.0.0 ├─ pumpify@1.5.1 ├─ punycode@1.4.1 ├─ qs@6.5.2 ├─ query-string@4.3.4 ├─ querystring-es3@0.2.1 ├─ querystring@0.2.0 ├─ randombytes@2.1.0 ├─ randomfill@1.0.4 ├─ rc@1.2.8 ├─ react-datetime@2.16.3 ├─ react-dom@16.9.0 ├─ react-hotkeys@2.0.0 ├─ react-is@16.9.0 ├─ react-onclickoutside@6.8.0 ├─ react-router-dom@5.0.1 ├─ react-router@5.0.1 ├─ react-tabs@3.0.0 ├─ react@16.9.0 ├─ read-config-file@5.0.0 ├─ read-pkg-up@2.0.0 ├─ read-pkg@4.0.1 ├─ readable-stream@2.3.6 ├─ readdirp@2.2.1 ├─ redent@1.0.0 ├─ regenerate-unicode-properties@8.1.0 ├─ regenerate@1.4.0 ├─ regenerator-runtime@0.13.3 ├─ regenerator-transform@0.14.1 ├─ regex-not@1.0.2 ├─ regexp-tree@0.1.11 ├─ regexpp@2.0.1 ├─ regexpu-core@4.5.5 ├─ regextras@0.6.1 ├─ registry-auth-token@3.4.0 ├─ registry-url@3.1.0 ├─ regjsgen@0.5.0 ├─ regjsparser@0.6.0 ├─ relateurl@0.2.7 ├─ remove-trailing-separator@1.1.0 ├─ renderkid@2.0.3 ├─ repeat-element@1.1.3 ├─ repeat-string@1.6.1 ├─ repeating@2.0.1 ├─ request@2.88.0 ├─ require-directory@2.1.1 ├─ require-main-filename@2.0.0 ├─ requireindex@1.1.0 ├─ resolve-cwd@2.0.0 ├─ resolve-dir@1.0.1 ├─ resolve-from@4.0.0 ├─ resolve-pathname@2.2.0 ├─ resolve-url@0.2.1 ├─ resolve@1.12.0 ├─ responselike@1.0.2 ├─ restore-cursor@3.1.0 ├─ ret@0.1.15 ├─ rimraf@2.7.0 ├─ ripemd160@2.0.2 ├─ run-async@2.3.0 ├─ run-queue@1.0.3 ├─ rxjs@6.5.2 ├─ safe-buffer@5.2.0 ├─ safe-regex@1.1.0 ├─ safer-buffer@2.1.2 ├─ sanitize-filename@1.6.2 ├─ sax@1.2.4 ├─ scheduler@0.15.0 ├─ schema-utils@1.0.0 ├─ sdp@1.5.4 ├─ semver-diff@2.1.0 ├─ semver@5.7.1 ├─ serialize-javascript@1.7.0 ├─ set-blocking@2.0.0 ├─ set-value@2.0.1 ├─ setimmediate@1.0.5 ├─ sha.js@2.4.11 ├─ shebang-command@1.2.0 ├─ shebang-regex@1.0.0 ├─ signal-exit@3.0.2 ├─ single-line-log@1.1.2 ├─ slash@2.0.0 ├─ slice-ansi@2.1.0 ├─ snapdragon-node@2.1.1 ├─ snapdragon-util@3.0.1 ├─ snapdragon@0.8.2 ├─ sort-keys@1.1.2 ├─ source-list-map@2.0.1 ├─ source-map-resolve@0.5.2 ├─ source-map-support@0.5.13 ├─ source-map-url@0.4.0 ├─ source-map@0.6.1 ├─ spawn-command@0.0.2-1 ├─ spdx-correct@3.1.0 ├─ spdx-exceptions@2.2.0 ├─ spdx-expression-parse@3.0.0 ├─ spdx-license-ids@3.0.5 ├─ speedometer@0.1.4 ├─ split-string@3.1.0 ├─ sprintf-js@1.0.3 ├─ sshpk@1.16.1 ├─ ssri@6.0.1 ├─ stat-mode@0.3.0 ├─ static-extend@0.1.2 ├─ stream-browserify@2.0.2 ├─ stream-each@1.2.3 ├─ stream-http@2.8.3 ├─ stream-shift@1.0.0 ├─ strict-uri-encode@1.1.0 ├─ string_decoder@1.3.0 ├─ string-width@3.1.0 ├─ strip-ansi@5.2.0 ├─ strip-bom@3.0.0 ├─ strip-eof@1.0.0 ├─ strip-indent@1.0.1 ├─ strip-json-comments@3.0.1 ├─ sumchecker@2.0.2 ├─ supports-color@5.5.0 ├─ table@5.4.5 ├─ tapable@1.1.3 ├─ tar@4.4.10 ├─ temp-file@3.3.4 ├─ temp@0.9.0 ├─ term-size@1.2.0 ├─ terser-webpack-plugin@1.4.1 ├─ terser@4.1.4 ├─ text-table@0.2.0 ├─ throttleit@0.0.2 ├─ through@2.3.8 ├─ through2@2.0.5 ├─ timed-out@4.0.1 ├─ timers-browserify@2.0.11 ├─ tiny-invariant@1.0.6 ├─ tiny-warning@1.0.3 ├─ tmp@0.0.33 ├─ to-arraybuffer@1.0.1 ├─ to-fast-properties@2.0.0 ├─ to-object-path@0.3.0 ├─ to-readable-stream@1.0.0 ├─ to-regex-range@2.1.1 ├─ to-regex@3.0.2 ├─ toposort@1.0.7 ├─ touch@3.1.0 ├─ tough-cookie@2.4.3 ├─ tree-kill@1.2.1 ├─ trim-newlines@1.0.0 ├─ trim-right@1.0.1 ├─ truncate-utf8-bytes@1.0.2 ├─ tslib@1.10.0 ├─ tty-browserify@0.0.0 ├─ tunnel-agent@0.6.0 ├─ tweetnacl@0.14.5 ├─ type-check@0.3.2 ├─ type-fest@0.3.1 ├─ typedarray@0.0.6 ├─ ua-parser-js@0.7.20 ├─ uglify-js@3.4.10 ├─ undefsafe@2.0.2 ├─ unicode-canonical-property-names-ecmascript@1.0.4 ├─ unicode-match-property-ecmascript@1.0.4 ├─ unicode-match-property-value-ecmascript@1.1.0 ├─ unicode-property-aliases-ecmascript@1.0.5 ├─ union-value@1.0.1 ├─ uniq@1.0.1 ├─ unique-filename@1.1.1 ├─ unique-slug@2.0.2 ├─ unique-string@1.0.0 ├─ universalify@0.1.2 ├─ unset-value@1.0.0 ├─ unzip-response@2.0.1 ├─ upath@1.1.2 ├─ update-notifier@2.5.0 ├─ upper-case@1.1.3 ├─ uri-js@4.2.2 ├─ urix@0.1.0 ├─ url-parse-lax@1.0.0 ├─ url@0.11.0 ├─ use@3.1.1 ├─ utf8-byte-length@1.0.4 ├─ util-deprecate@1.0.2 ├─ util.promisify@1.0.0 ├─ util@0.11.1 ├─ utila@0.4.0 ├─ uuid@3.3.2 ├─ v8-compile-cache@2.0.3 ├─ validate-npm-package-license@3.0.4 ├─ value-equal@0.4.0 ├─ varname@2.0.2 ├─ verror@1.10.0 ├─ vm-browserify@1.1.0 ├─ watchpack@1.6.0 ├─ webpack-cli@3.3.6 ├─ webpack-hot-middleware@2.25.0 ├─ webpack-sources@1.4.3 ├─ webpack@4.39.2 ├─ webrtc-adapter@2.1.0 ├─ whatwg-fetch@3.0.0 ├─ which-module@2.0.0 ├─ which@1.3.1 ├─ wide-align@1.1.3 ├─ widest-line@2.0.1 ├─ wordwrap@1.0.0 ├─ worker-farm@1.7.0 ├─ wrap-ansi@5.1.0 ├─ wrappy@1.0.2 ├─ write-file-atomic@2.4.3 ├─ write@1.0.3 ├─ ws@7.1.2 ├─ xdg-basedir@3.0.0 ├─ xtend@4.0.2 ├─ y18n@4.0.0 ├─ yallist@3.0.3 ├─ yargs-parser@13.1.1 ├─ yargs@13.2.4 └─ yauzl@2.4.1 ```
valentineus commented 5 years ago

I see this issue, but the method don't work.

externals: {
    'electron-reload': 'electron-reload',
},

Result:

A JavaScript error occurred in the main process
Uncaught Exception:
ReferenceError: electron is not defined
    at eval (webpack:///external_%22electron-reload%22?:1:18)
...
valentineus commented 5 years ago

I've created a repository to test this situation.

valentineus commented 5 years ago

I see the problem that is in the WebPack.

So I've found a solution to the problem. You should add a section to a config file.

node: {
  __dirname: false
}

Maybe, add this information to the README file?

WebPack example config ```javascript const path = require('path'); module.exports = { mode: "development", target: 'electron-main', entry: { main: './src/main.js' }, output: { path: path.resolve(__dirname, 'dist'), filename: '[name].js' }, module: { rules: [{ test: /\.js$/, exclude: /(node_modules|bower_components)/, use: { loader: 'babel-loader', options: { babelrc: false, presets: ['@babel/preset-env'] } } }] }, node: { __dirname: false } } ```
yan-foto commented 5 years ago

Hi @valentineus , thanks for getting involved in this project, but as you already found out, this is not a bug within electron-relaod. I'll close this issue and will add a note in README in future releases.