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

Linux Package: Cannot use import statement outside a module #330

Closed
rithvikvibhu opened this issue Apr 12, 2021 · 0 comments · Fixed by #350
Closed

Linux Package: Cannot use import statement outside a module #330

rithvikvibhu opened this issue Apr 12, 2021 · 0 comments · Fixed by #350

Comments

@rithvikvibhu
Copy link
Collaborator

There's probably nothing wrong with the code because others can still build fine. Leaving it here if others face the same problem. Feel free to close (though I would want to find out why this change was required).

Expected Behavior

Launch normally

Current Behavior

After packaging for linux successfully, the AppImage doesn't start and errors with:
image

Steps to Reproduce

  1. npm i
  2. npm run package-linux
  3. ./release/***.AppImage

Logs

While building babel did complain about this one line, but doesn't seem directly to be related

SyntaxError: /home/rithvik/projects/handshake/bob-wallet/app/background/wallet/service.js: Support for the experimental syntax 'classProperties' isn't currently enabled (53:13):

  51 |   }
  52 | 
> 53 |   setWallet = (name) => {
     |             ^
  54 |     this.didSelectWallet = false;
  55 |     this.name = name;
  56 |   };

Add @babel/plugin-proposal-class-properties (https://git.io/vb4SL) to the 'plugins' section of your Babel config to enable transformation.
If you want to leave it as-is, add @babel/plugin-syntax-class-properties (https://git.io/vb4yQ) to the 'plugins' section to enable parsing.

Solution

babel/babel-loader#780 (comment)

  1. rename .babelrc to babel.config.json
  2. require() the json in the webpack prod config
  3. pass that object to babel-loader as options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant