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

Uncaught SyntaxError: Unexpected token . #108

Closed
wesias7 opened this issue Aug 25, 2018 · 4 comments
Closed

Uncaught SyntaxError: Unexpected token . #108

wesias7 opened this issue Aug 25, 2018 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@wesias7
Copy link

wesias7 commented Aug 25, 2018

When "Server Side Rendering", it is not loaded due to the "Calendar.cs" file in "entry.js".

And I'm going to do this. However, it requires patches.

if(typeof window === 'object' && window){ require('./Calendar.css'); }

The message below shows my error.

(function (exports, require, module, __filename, __dirname) { .react-calendar {

SyntaxError: Unexpected token .
    at new Script (vm.js:51:7)
    at createScript (vm.js:136:10)
    at Object.runInThisContext (vm.js:197:10)
    at Module._compile (module.js:613:28)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Module.require (module.js:593:17)
    at require (internal/module.js:11:18)
@wesias7
Copy link
Author

wesias7 commented Aug 25, 2018

Relative Solutions.
diegohaz/arc#350 (comment)

@wojtekmaj
Copy link
Owner

wojtekmaj commented Aug 27, 2018

This is not a valid patch. On SSR, there should be CSS loaded as well. Otherwise you will get a flash of unstyled content or the page will be broken if the user disables JS.

You should configure your Webpack properly to load CSS files, or opt-out from loading the default styles by using entry.nostyle (more in README).

@wojtekmaj wojtekmaj self-assigned this Aug 27, 2018
@wojtekmaj wojtekmaj added the question Further information is requested label Aug 27, 2018
@wesias7
Copy link
Author

wesias7 commented Aug 30, 2018

thanks for your anwser!!

@wojtekmaj wojtekmaj changed the title React-calendar Server Side Error. (Calendar.css in entry.js) Uncaught SyntaxError: Unexpected token . Dec 31, 2018
@ffasolin
Copy link

ffasolin commented Jul 29, 2019

To anyone who wants to import the calendar with style and is still having issues, this is what you need to do: jestjs/jest#3094

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants