-
Notifications
You must be signed in to change notification settings - Fork 130
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
Question about importing css and scss. #126
Comments
Also I see you've referred people to issue #80 but that's just for copying CSS, not compiling the SCSS. |
Correction. It couldn't find my ./css/App.css file because it was a path error. However, I switched to this plugin in .babelrc :
and now it compiles without the word salad error. However, when it loads the window the console still says it can't find the node module import: |
This .babelrc from this webpack issue got me working:
|
I just noticed it's not erroring out but it's also not actually loading the CSS from the @aws-amplify/ui-react/styles.css. It should have a static/css output somewhere if it worked like the npx create-react-app. Apologies for my lack of depth on the node.js build processes. Any ideas on what I need to get my CSS to static compile when importing it into my Javascript or Typescript files? |
It seems like the solution should be added into your developBuild function since it needs to act on CSS imported from inside the JS files you're processing.
So probably I'm on the right path about getting the right plugin during that pipe(babel()) step. |
Hey Dave, I think Babel should expand those CSS For TypeScript specifically, project configuration is a little different and I usually send people to take a look at mullvad/mullvadvpn-app@ca022b8#diff-f31c2ebc4f1f1d98595dcf39ed151888d164b0a80da5f35d932540a44377a905 which has incremental TypeScript compiler plugged in, but that does not give you any CSS/SASS support. We mostly use Styled components and those things are pure JS. |
Do you use https://github.com/gajus/babel-plugin-react-css-modules for Babel? |
I was using import and not @import. Does babel require the @?
On Aug 8, 2022 12:14 PM, Andrej Mihajlov ***@***.***> wrote:
Do you use https://github.com/gajus/babel-plugin-react-css-modules for Babel?
-
Reply to this email directly, view it on GitHub<#126 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AOLHGXFHC2S3GQZM4IHWGV3VYFMBPANCNFSM55533BSA>.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
@davetbo-amzn typo on my side. In JS you should use |
Hello,
I'm trying to use your boilerplate to create a boilerplate of Electron, React, Redux, and Amplify. However, when I do this in my Javascript:
import '@aws-amplify/ui-react/styles.css';
and then do yarn run develop, it compiles OK but I get this in the console output:
Uncaught Error: Cannot find module '@aws-amplify/ui-react/styles.css
So then I figured maybe I should do a .babelrc like this:
With that .babelrc enabled I get this error when I run yarn run develop:
My App.js file is as follows:
As you can see I commented out everything Amplify-specific. I should note that './css/App.css' is plain CSS. I get the same result if I try to uncomment the line that imports '@aws-amplify/ui-react/styles.css' so I know I can't import things from node modules either.
I'm sure it's because I'm not super familiar with Gulp and Babel, but could you provide an explicit example where importing CSS and SCSS works and gets compiled down to regular CSS either way, like it would do if I did npx create-react-app? I'm an SA, not an SDE :D.
The text was updated successfully, but these errors were encountered: