Skip to content
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

logs4js error in main process #1726

Closed
3 tasks done
fragoulin opened this issue May 30, 2020 · 4 comments
Closed
3 tasks done

logs4js error in main process #1726

fragoulin opened this issue May 30, 2020 · 4 comments
Labels
blocked/upstream Issues blocked by upstream bugs bug plugin/webpack Issues or pull requests related to first-party webpack plugins/templates

Comments

@fragoulin
Copy link

fragoulin commented May 30, 2020

Preflight Checklist

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for a bug that matches the one I want to file, without success.

Issue Details

  • Electron Forge Version:
    • 6.0.0-beta.51
  • Electron Version:
    • 9.0.0
  • Operating System:
    • Windows 10 (1909)
  • Last Known Working Electron Forge version::
    • N/A
  • Node version:
    • v12.16.2

Expected Behavior

I want to use log4js (https://github.com/log4js-node/log4js-node)

Actual Behavior

Creating a simple logger fails when starting electron, in extension https://github.com/MarshallOfSound/webpack-asset-relocator-loader
This extension is installed when following steps in https://www.electronforge.io/templates/typescript-+-webpack-template

To Reproduce

  1. $ yarn create electron-app my-new-app --template=typescript-webpack
  2. $ yarn add log4js
  3. add the following code to index.ts file :
import log4js from 'log4js'
const logger = log4js.getLogger()
logger.log('main process')

Additional Information

Error trace :
$ yarn start

yarn run v1.22.4
$ electron-forge start
√ Checking your system
√ Locating Application
√ Preparing native dependencies
√ Compiling Main Process Code

  • Launch Dev ServersStarting type checking service...
    Using 1 worker with 2048MB memory limit
    √ Launch Dev Servers
    √ Compiling Preload Scripts
    √ Launching Application

Webpack Output Available: http://localhost:9000

App threw an error during load
Error: Module build failed (from ./node_modules/@marshallofsound/webpack-asset-relocator-loader/dist/index.js):
SyntaxError: Unexpected token (86:14)
at Object.module.exports.pp$4.raise (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:20834:13)
at Object.module.exports.pp.unexpected (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:18680:8)
at Object.module.exports.pp$1.parseTryStatement (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:19069:49)
at Object.module.exports.pp$1.parseStatement (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:18834:32)
at Object.parseStatement (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:4539:118)
at Object.parseStatement (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:42314:22)
at Object.module.exports.pp$1.parseBlock (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:19157:23)
at Object.module.exports.pp$1.parseTryStatement (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:19073:24)
at Object.module.exports.pp$1.parseStatement (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:18834:32)
at Object.parseStatement (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:4539:118)
at Object.parseStatement (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:42314:22)
at Object.module.exports.pp$1.parseBlock (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:19157:23)
at Object.module.exports.pp$3.parseFunctionBody (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:20675:22)
at Object.module.exports.pp$3.parseArrowExpression (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:20638:8)
at Object.module.exports.pp$3.parseExprAtom (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:20227:21)
at Object.parseExprAtom (C:\Users\fab\source\repos\my-new-app\node_modules@marshallofsound\webpack-asset-relocator-loader\dist\index.js:4551:117)
at Object../node_modules/fs-extra/lib/mkdirs/make-dir.js (C:\Users\fab\source\repos\my-new-app.webpack\main\index.js:2451:7)
at webpack_require (C:\Users\fab\source\repos\my-new-app.webpack\main\index.js:21:30)
at Object../node_modules/fs-extra/lib/mkdirs/index.js (C:\Users\fab\source\repos\my-new-app.webpack\main\index.js:2428:44)
at webpack_require (C:\Users\fab\source\repos\my-new-app.webpack\main\index.js:21:30)
at Object../node_modules/fs-extra/lib/copy-sync/copy-sync.js (C:\Users\fab\source\repos\my-new-app.webpack\main\index.js:1368:20)
at webpack_require (C:\Users\fab\source\repos\my-new-app.webpack\main\index.js:21:30)
at Object../node_modules/fs-extra/lib/copy-sync/index.js (C:\Users\fab\source\repos\my-new-app.webpack\main\index.js:1545:13)
at webpack_require (C:\Users\fab\source\repos\my-new-app.webpack\main\index.js:21:30)
at Object../node_modules/fs-extra/lib/index.js (C:\Users\fab\source\repos\my-new-app.webpack\main\index.js:2294:6)
at webpack_require (C:\Users\fab\source\repos\my-new-app.webpack\main\index.js:21:30)
Type checking in progress...
webpack built 4444f6a00c07388e4c85 in 904ms
No type errors found
Version: typescript 3.9.3
Time: 2712ms

This error is due to a catch statement without parameter in fs-extra extension :

      try {
        const stats = await fs.stat(pth)
        if (!stats.isDirectory()) {
          // This error is never exposed to the user
          // it is caught below, and the original error is thrown
          throw new Error('The path is not a directory')
        }
      } catch {
        throw error
      }

MarshallOfSound extension cannot handle catch statements without parameters, but it's valid JS.

Reproduced on this repository : https://github.com/fragoulin/my-new-app

@fragoulin fragoulin added the bug label May 30, 2020
@Andreybest
Copy link

Having the same issue with discord.js, does anybody have workaround for this, or we need to wait for a bug fix?

@malept malept added the plugin/webpack Issues or pull requests related to first-party webpack plugins/templates label Jul 8, 2020
@barbalex
Copy link

barbalex commented Jul 9, 2020

I get this when updating from v6.0.0-beta.50 to v6.0.0-beta.52, 6.0.0-beta.53 or 6.0.0-beta.54

@JasinYip
Copy link

Any news? facing the same error here 😢

@malept malept added the blocked/upstream Issues blocked by upstream bugs label Jun 18, 2021
@malept
Copy link
Member

malept commented Jun 18, 2021

This seems like a general Webpack issue and not Electron Forge specific. See: log4js-node/log4js-node#968

I've also verified that there are errors regardless of whether the asset relocator plugin is enabled in the Webpack config.

Since it seems like there's nothing actionable that we can do on the Electron Forge side, I'm closing this bug.

@malept malept closed this as completed Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/upstream Issues blocked by upstream bugs bug plugin/webpack Issues or pull requests related to first-party webpack plugins/templates
Projects
None yet
Development

No branches or pull requests

5 participants