Unexpected token . while add css to jsx file












1















This is the error I am getting.



    /Users/gkapatia/git/bolo-mobile-web
app/src/components/AnswerDetail/AnswerDetail.css:1
(function (exports, require, module, __filename, __dirname) { .example-appear {
^

SyntaxError: Unexpected token .
at new Script (vm.js:83:7)
at createScript (vm.js:267:10)
at Object.runInThisContext (vm.js:319:10)
at Module._compile (internal/modules/cjs/loader.js:685:28)
at Module._extensions..js (internal/modules/cjs/loader.js:733:10)
at Object.newLoader [as .js] (/Users/gkapatia/git/bolo-mobile-web-app/node_modules/pirates/lib/index.js:88:7)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/Users/gkapatia/git/bolo-mobile-web-app/src/components/AnswerDetail/AnswerDetail.jsx:12:1)
at Module._compile (internal/modules/cjs/loader.js:722:30)
at Module._compile (/Users/gkapatia/git/bolo-mobile-web-app/node_modules/pirates/lib/index.js:83:24)
at Module._extensions..js (internal/modules/cjs/loader.js:733:10)
at Object.newLoader [as .jsx] (/Users/gkapatia/git/bolo-mobile-web-app/node_modules/pirates/lib/index.js:88:7)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:658:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/Users/gkapatia/git/bolo-mobile-web-app/src/App.jsx:3:1)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


This is how i imported my css:



    import AnswerDetailCss from './AnswerDetail.css';


This is in my webpack config file:



    {
test: /.css$/,
use: [
'style-loader',
{ loader: 'css-loader', options: { importLoaders: 1 } }
]
}


I have tried each and everything in different questions in stackoverflow but still not able to figure this out. I have using webpack 4, babel 7!



Edit::::::



File Structure. I am using import stte ment in AnswerDetail.jsx for AnswerDetail.css.



   <pre> /Users/gkapatia/git/bolo-mobile-web-app
├── data
| ├── api-real-url.js
| └── mock-answer.json
├── dist
| └── bundle.js
├── node_modules
| ├── all node mdules
├── out.txt
├── package.json
├── public
| └── index.html
├── readme.md
├── server
| └── index.jsx
├── src
| ├── App.jsx
| ├── assests
| | ├── bolo_logo.png
| | └── bolo_white.png
| ├── components
| | ├── AnswerDetail
| | | ├── AnswerDetail.css
| | | ├── AnswerDetail.jsx
| | | └── style.js
| | └── common
| | ├── ShareDialog
| | | ├── ShareDialog.css
| | | └── ShareDialog.jsx
| | └── VideoPlayer
| | └── VideoPlayer.jsx
| ├── getStore.js
| ├── index.jsx
| ├── reducers
| | ├── answers.js
| | └── index.js
| ├── sagas
| | └── fetch-answers-saga.js
| └── styles
| └── App.css
├── util
| └── log.js
├── webpack.config.dev.babel.js
├── webpack.config.prod.babel.js
├── yarn-error.log
└── yarn.lock




Edit:::::::::
this is my css file



    .example-appear {
opacity: 0.01;
}









share|improve this question





























    1















    This is the error I am getting.



        /Users/gkapatia/git/bolo-mobile-web
    app/src/components/AnswerDetail/AnswerDetail.css:1
    (function (exports, require, module, __filename, __dirname) { .example-appear {
    ^

    SyntaxError: Unexpected token .
    at new Script (vm.js:83:7)
    at createScript (vm.js:267:10)
    at Object.runInThisContext (vm.js:319:10)
    at Module._compile (internal/modules/cjs/loader.js:685:28)
    at Module._extensions..js (internal/modules/cjs/loader.js:733:10)
    at Object.newLoader [as .js] (/Users/gkapatia/git/bolo-mobile-web-app/node_modules/pirates/lib/index.js:88:7)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/gkapatia/git/bolo-mobile-web-app/src/components/AnswerDetail/AnswerDetail.jsx:12:1)
    at Module._compile (internal/modules/cjs/loader.js:722:30)
    at Module._compile (/Users/gkapatia/git/bolo-mobile-web-app/node_modules/pirates/lib/index.js:83:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:733:10)
    at Object.newLoader [as .jsx] (/Users/gkapatia/git/bolo-mobile-web-app/node_modules/pirates/lib/index.js:88:7)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/gkapatia/git/bolo-mobile-web-app/src/App.jsx:3:1)
    error Command failed with exit code 1.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


    This is how i imported my css:



        import AnswerDetailCss from './AnswerDetail.css';


    This is in my webpack config file:



        {
    test: /.css$/,
    use: [
    'style-loader',
    { loader: 'css-loader', options: { importLoaders: 1 } }
    ]
    }


    I have tried each and everything in different questions in stackoverflow but still not able to figure this out. I have using webpack 4, babel 7!



    Edit::::::



    File Structure. I am using import stte ment in AnswerDetail.jsx for AnswerDetail.css.



       <pre> /Users/gkapatia/git/bolo-mobile-web-app
    ├── data
    | ├── api-real-url.js
    | └── mock-answer.json
    ├── dist
    | └── bundle.js
    ├── node_modules
    | ├── all node mdules
    ├── out.txt
    ├── package.json
    ├── public
    | └── index.html
    ├── readme.md
    ├── server
    | └── index.jsx
    ├── src
    | ├── App.jsx
    | ├── assests
    | | ├── bolo_logo.png
    | | └── bolo_white.png
    | ├── components
    | | ├── AnswerDetail
    | | | ├── AnswerDetail.css
    | | | ├── AnswerDetail.jsx
    | | | └── style.js
    | | └── common
    | | ├── ShareDialog
    | | | ├── ShareDialog.css
    | | | └── ShareDialog.jsx
    | | └── VideoPlayer
    | | └── VideoPlayer.jsx
    | ├── getStore.js
    | ├── index.jsx
    | ├── reducers
    | | ├── answers.js
    | | └── index.js
    | ├── sagas
    | | └── fetch-answers-saga.js
    | └── styles
    | └── App.css
    ├── util
    | └── log.js
    ├── webpack.config.dev.babel.js
    ├── webpack.config.prod.babel.js
    ├── yarn-error.log
    └── yarn.lock




    Edit:::::::::
    this is my css file



        .example-appear {
    opacity: 0.01;
    }









    share|improve this question



























      1












      1








      1








      This is the error I am getting.



          /Users/gkapatia/git/bolo-mobile-web
      app/src/components/AnswerDetail/AnswerDetail.css:1
      (function (exports, require, module, __filename, __dirname) { .example-appear {
      ^

      SyntaxError: Unexpected token .
      at new Script (vm.js:83:7)
      at createScript (vm.js:267:10)
      at Object.runInThisContext (vm.js:319:10)
      at Module._compile (internal/modules/cjs/loader.js:685:28)
      at Module._extensions..js (internal/modules/cjs/loader.js:733:10)
      at Object.newLoader [as .js] (/Users/gkapatia/git/bolo-mobile-web-app/node_modules/pirates/lib/index.js:88:7)
      at Module.load (internal/modules/cjs/loader.js:620:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
      at Function.Module._load (internal/modules/cjs/loader.js:552:3)
      at Module.require (internal/modules/cjs/loader.js:658:17)
      at require (internal/modules/cjs/helpers.js:22:18)
      at Object.<anonymous> (/Users/gkapatia/git/bolo-mobile-web-app/src/components/AnswerDetail/AnswerDetail.jsx:12:1)
      at Module._compile (internal/modules/cjs/loader.js:722:30)
      at Module._compile (/Users/gkapatia/git/bolo-mobile-web-app/node_modules/pirates/lib/index.js:83:24)
      at Module._extensions..js (internal/modules/cjs/loader.js:733:10)
      at Object.newLoader [as .jsx] (/Users/gkapatia/git/bolo-mobile-web-app/node_modules/pirates/lib/index.js:88:7)
      at Module.load (internal/modules/cjs/loader.js:620:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
      at Function.Module._load (internal/modules/cjs/loader.js:552:3)
      at Module.require (internal/modules/cjs/loader.js:658:17)
      at require (internal/modules/cjs/helpers.js:22:18)
      at Object.<anonymous> (/Users/gkapatia/git/bolo-mobile-web-app/src/App.jsx:3:1)
      error Command failed with exit code 1.
      info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


      This is how i imported my css:



          import AnswerDetailCss from './AnswerDetail.css';


      This is in my webpack config file:



          {
      test: /.css$/,
      use: [
      'style-loader',
      { loader: 'css-loader', options: { importLoaders: 1 } }
      ]
      }


      I have tried each and everything in different questions in stackoverflow but still not able to figure this out. I have using webpack 4, babel 7!



      Edit::::::



      File Structure. I am using import stte ment in AnswerDetail.jsx for AnswerDetail.css.



         <pre> /Users/gkapatia/git/bolo-mobile-web-app
      ├── data
      | ├── api-real-url.js
      | └── mock-answer.json
      ├── dist
      | └── bundle.js
      ├── node_modules
      | ├── all node mdules
      ├── out.txt
      ├── package.json
      ├── public
      | └── index.html
      ├── readme.md
      ├── server
      | └── index.jsx
      ├── src
      | ├── App.jsx
      | ├── assests
      | | ├── bolo_logo.png
      | | └── bolo_white.png
      | ├── components
      | | ├── AnswerDetail
      | | | ├── AnswerDetail.css
      | | | ├── AnswerDetail.jsx
      | | | └── style.js
      | | └── common
      | | ├── ShareDialog
      | | | ├── ShareDialog.css
      | | | └── ShareDialog.jsx
      | | └── VideoPlayer
      | | └── VideoPlayer.jsx
      | ├── getStore.js
      | ├── index.jsx
      | ├── reducers
      | | ├── answers.js
      | | └── index.js
      | ├── sagas
      | | └── fetch-answers-saga.js
      | └── styles
      | └── App.css
      ├── util
      | └── log.js
      ├── webpack.config.dev.babel.js
      ├── webpack.config.prod.babel.js
      ├── yarn-error.log
      └── yarn.lock




      Edit:::::::::
      this is my css file



          .example-appear {
      opacity: 0.01;
      }









      share|improve this question
















      This is the error I am getting.



          /Users/gkapatia/git/bolo-mobile-web
      app/src/components/AnswerDetail/AnswerDetail.css:1
      (function (exports, require, module, __filename, __dirname) { .example-appear {
      ^

      SyntaxError: Unexpected token .
      at new Script (vm.js:83:7)
      at createScript (vm.js:267:10)
      at Object.runInThisContext (vm.js:319:10)
      at Module._compile (internal/modules/cjs/loader.js:685:28)
      at Module._extensions..js (internal/modules/cjs/loader.js:733:10)
      at Object.newLoader [as .js] (/Users/gkapatia/git/bolo-mobile-web-app/node_modules/pirates/lib/index.js:88:7)
      at Module.load (internal/modules/cjs/loader.js:620:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
      at Function.Module._load (internal/modules/cjs/loader.js:552:3)
      at Module.require (internal/modules/cjs/loader.js:658:17)
      at require (internal/modules/cjs/helpers.js:22:18)
      at Object.<anonymous> (/Users/gkapatia/git/bolo-mobile-web-app/src/components/AnswerDetail/AnswerDetail.jsx:12:1)
      at Module._compile (internal/modules/cjs/loader.js:722:30)
      at Module._compile (/Users/gkapatia/git/bolo-mobile-web-app/node_modules/pirates/lib/index.js:83:24)
      at Module._extensions..js (internal/modules/cjs/loader.js:733:10)
      at Object.newLoader [as .jsx] (/Users/gkapatia/git/bolo-mobile-web-app/node_modules/pirates/lib/index.js:88:7)
      at Module.load (internal/modules/cjs/loader.js:620:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
      at Function.Module._load (internal/modules/cjs/loader.js:552:3)
      at Module.require (internal/modules/cjs/loader.js:658:17)
      at require (internal/modules/cjs/helpers.js:22:18)
      at Object.<anonymous> (/Users/gkapatia/git/bolo-mobile-web-app/src/App.jsx:3:1)
      error Command failed with exit code 1.
      info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


      This is how i imported my css:



          import AnswerDetailCss from './AnswerDetail.css';


      This is in my webpack config file:



          {
      test: /.css$/,
      use: [
      'style-loader',
      { loader: 'css-loader', options: { importLoaders: 1 } }
      ]
      }


      I have tried each and everything in different questions in stackoverflow but still not able to figure this out. I have using webpack 4, babel 7!



      Edit::::::



      File Structure. I am using import stte ment in AnswerDetail.jsx for AnswerDetail.css.



         <pre> /Users/gkapatia/git/bolo-mobile-web-app
      ├── data
      | ├── api-real-url.js
      | └── mock-answer.json
      ├── dist
      | └── bundle.js
      ├── node_modules
      | ├── all node mdules
      ├── out.txt
      ├── package.json
      ├── public
      | └── index.html
      ├── readme.md
      ├── server
      | └── index.jsx
      ├── src
      | ├── App.jsx
      | ├── assests
      | | ├── bolo_logo.png
      | | └── bolo_white.png
      | ├── components
      | | ├── AnswerDetail
      | | | ├── AnswerDetail.css
      | | | ├── AnswerDetail.jsx
      | | | └── style.js
      | | └── common
      | | ├── ShareDialog
      | | | ├── ShareDialog.css
      | | | └── ShareDialog.jsx
      | | └── VideoPlayer
      | | └── VideoPlayer.jsx
      | ├── getStore.js
      | ├── index.jsx
      | ├── reducers
      | | ├── answers.js
      | | └── index.js
      | ├── sagas
      | | └── fetch-answers-saga.js
      | └── styles
      | └── App.css
      ├── util
      | └── log.js
      ├── webpack.config.dev.babel.js
      ├── webpack.config.prod.babel.js
      ├── yarn-error.log
      └── yarn.lock




      Edit:::::::::
      this is my css file



          .example-appear {
      opacity: 0.01;
      }






      css reactjs webpack babel






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 27 '18 at 11:58







      gkapatia

















      asked Nov 27 '18 at 10:58









      gkapatiagkapatia

      63




      63
























          1 Answer
          1






          active

          oldest

          votes


















          0














          Nothing has been exported from css file.
          Fix this...



          import './AnswerDetail.css';


          Modify the Config File...



          {
          test: /.css$/,
          use: [
          { loader: "style-loader" },
          { loader: 'css-loader', options: { importLoaders: 1 } }
          ]
          }





          share|improve this answer


























          • i tried this too but same error :(

            – gkapatia
            Nov 27 '18 at 11:17











          • then you need to check your path and file name... Could you mention the file structure and file name here?

            – OneJeet
            Nov 27 '18 at 11:17











          • sure. wait a moment

            – gkapatia
            Nov 27 '18 at 11:18











          • can you have a look once agin @OneJeet

            – gkapatia
            Nov 27 '18 at 11:30











          • in which file you are importing this css file

            – OneJeet
            Nov 27 '18 at 11:33











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53498158%2funexpected-token-while-add-css-to-jsx-file%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Nothing has been exported from css file.
          Fix this...



          import './AnswerDetail.css';


          Modify the Config File...



          {
          test: /.css$/,
          use: [
          { loader: "style-loader" },
          { loader: 'css-loader', options: { importLoaders: 1 } }
          ]
          }





          share|improve this answer


























          • i tried this too but same error :(

            – gkapatia
            Nov 27 '18 at 11:17











          • then you need to check your path and file name... Could you mention the file structure and file name here?

            – OneJeet
            Nov 27 '18 at 11:17











          • sure. wait a moment

            – gkapatia
            Nov 27 '18 at 11:18











          • can you have a look once agin @OneJeet

            – gkapatia
            Nov 27 '18 at 11:30











          • in which file you are importing this css file

            – OneJeet
            Nov 27 '18 at 11:33
















          0














          Nothing has been exported from css file.
          Fix this...



          import './AnswerDetail.css';


          Modify the Config File...



          {
          test: /.css$/,
          use: [
          { loader: "style-loader" },
          { loader: 'css-loader', options: { importLoaders: 1 } }
          ]
          }





          share|improve this answer


























          • i tried this too but same error :(

            – gkapatia
            Nov 27 '18 at 11:17











          • then you need to check your path and file name... Could you mention the file structure and file name here?

            – OneJeet
            Nov 27 '18 at 11:17











          • sure. wait a moment

            – gkapatia
            Nov 27 '18 at 11:18











          • can you have a look once agin @OneJeet

            – gkapatia
            Nov 27 '18 at 11:30











          • in which file you are importing this css file

            – OneJeet
            Nov 27 '18 at 11:33














          0












          0








          0







          Nothing has been exported from css file.
          Fix this...



          import './AnswerDetail.css';


          Modify the Config File...



          {
          test: /.css$/,
          use: [
          { loader: "style-loader" },
          { loader: 'css-loader', options: { importLoaders: 1 } }
          ]
          }





          share|improve this answer















          Nothing has been exported from css file.
          Fix this...



          import './AnswerDetail.css';


          Modify the Config File...



          {
          test: /.css$/,
          use: [
          { loader: "style-loader" },
          { loader: 'css-loader', options: { importLoaders: 1 } }
          ]
          }






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 27 '18 at 11:48

























          answered Nov 27 '18 at 11:08









          OneJeetOneJeet

          962310




          962310













          • i tried this too but same error :(

            – gkapatia
            Nov 27 '18 at 11:17











          • then you need to check your path and file name... Could you mention the file structure and file name here?

            – OneJeet
            Nov 27 '18 at 11:17











          • sure. wait a moment

            – gkapatia
            Nov 27 '18 at 11:18











          • can you have a look once agin @OneJeet

            – gkapatia
            Nov 27 '18 at 11:30











          • in which file you are importing this css file

            – OneJeet
            Nov 27 '18 at 11:33



















          • i tried this too but same error :(

            – gkapatia
            Nov 27 '18 at 11:17











          • then you need to check your path and file name... Could you mention the file structure and file name here?

            – OneJeet
            Nov 27 '18 at 11:17











          • sure. wait a moment

            – gkapatia
            Nov 27 '18 at 11:18











          • can you have a look once agin @OneJeet

            – gkapatia
            Nov 27 '18 at 11:30











          • in which file you are importing this css file

            – OneJeet
            Nov 27 '18 at 11:33

















          i tried this too but same error :(

          – gkapatia
          Nov 27 '18 at 11:17





          i tried this too but same error :(

          – gkapatia
          Nov 27 '18 at 11:17













          then you need to check your path and file name... Could you mention the file structure and file name here?

          – OneJeet
          Nov 27 '18 at 11:17





          then you need to check your path and file name... Could you mention the file structure and file name here?

          – OneJeet
          Nov 27 '18 at 11:17













          sure. wait a moment

          – gkapatia
          Nov 27 '18 at 11:18





          sure. wait a moment

          – gkapatia
          Nov 27 '18 at 11:18













          can you have a look once agin @OneJeet

          – gkapatia
          Nov 27 '18 at 11:30





          can you have a look once agin @OneJeet

          – gkapatia
          Nov 27 '18 at 11:30













          in which file you are importing this css file

          – OneJeet
          Nov 27 '18 at 11:33





          in which file you are importing this css file

          – OneJeet
          Nov 27 '18 at 11:33




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53498158%2funexpected-token-while-add-css-to-jsx-file%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Lallio

          Futebolista

          Jornalista