-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
importing 'aws-amplify-react', ERROR: Uncaught SyntaxError: Unexpected token : #2230
Comments
Having this same issue with the electron-react-boilerplate and amplify. After taking a quick look, |
Hi @robbylucia, We may need to bundle our css in the react package with something like rollup for it to properly work with that electron boilerplate package. I will look into what is required for this. As a workaround you should be able to spin up a create-react-app and then add electron to it. Here is an example article tutorial: @barrypeterson The files in src/ are indeed PostCSS but the listed file @aws-amplify/ui/dist/style.css is still a plain css as it has been compiled using webpack. |
I found a workaround here: vercel/next-plugins#267 (comment) |
Hey @cgarvis , thanks for that, although I'm having trouble figuring out where to put this fix for a production build of electron. It only fixes the problem in dev when I place it at the top of babel.config.js, prod is still an issue for me. Any ideas? |
Hey @jordanranz , |
hey @robbylucia, Wouldn't want you to have to start over. The main problem is that the build process is not recognizing/loading .css files. Here is an alternative work around: If you are using that electron boilerplate, you should be able to add a css loader to the webpack configuration: https://github.com/webpack-contrib/css-loader. We need to add a similar process to our react package for this to be a permanent fix. This requires us to have a bundler. I have started to test out a few bundlers for this. This is a high priority item that should be fixed within the next month. I will update this as soon as this change has been made. |
Hi @jordanranz, Can you or someone else maybe elaborate more on the css loader workaround you mentioned? |
I stumbled upon this issue myself, workaround for me was to use UMD build instead. |
@patotoma sorry, could you elaborate on what the UMD build is and where to get it? |
@sammartinez @jordanranz what would be the current workaround for this issue? I'm having similar problems using plain |
You can get UMD build using CDN e.g. https://unpkg.com/aws-amplify@1.1.7/dist/aws-amplify.min.js You will then use it in a script tag like this:
|
any update on this issue ? |
The issue with I've found workaround for this (not sure if it works in production). Then I've just added Probably the fix could be using proper CSS transpiler. |
This was resolved back in March. Please let us know if you are still having issues. |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Describe the bug
Trying to import
aws-amplify-react
into anelectron-react-boilerplate
component yields the following error in the electron browser:vm.js:74 Uncaught SyntaxError: Unexpected token : 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)
To Reproduce
Steps to reproduce the behavior:
electron-react-boilerplate
Expected behavior
Have module be imported and have my component/react app working and displaying.
Desktop (please complete the following information):
Additional context
A maintainer of
electron-react-boilerplate
said it may be related to requiring CSS or something. Not sure.electron-react-boilerplate/electron-react-boilerplate#2040 (comment)
Does anyone have an idea?
The text was updated successfully, but these errors were encountered: