kriasoft / kriasoft/react-app

Possible babel issues when migrating existing CRA

Open
#30 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
612
Forks
76
PR merge metrics
No merged PRs in 30d

Description

I have a working CRA app that I want to add SSR to. This SDK looks promising!

I tried following the steps in the readme. Although the server does start, during loading I get a compilation error:

(function (exports, require, module, __filename, __dirname) { .react-datepicker-popper[data-placement^="bottom"] .react-datepicker__triangle, .react-datepicker-popper[data-placement^="top"] .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow, ^ SyntaxError: Unexpected token . at createScript (vm.js:53:10) at Object.runInThisContext (vm.js:95:10) at Module._compile (module.js:543:28) ...

This appears to be because I'm importing a css file from node_modules like so:

import "react-datepicker/dist/react-datepicker.css";

This works in the regular CRA app, but not after the migration. I'm not exactly sure how to fix that, but I assumed I might need to use config-overrides.js to add some custom babel configuration? However, when I add the default config-overrides.js. I get the following error:

/Users/<blahblahblah>/client/config-overrides.js:4 ...config, ^^^ SyntaxError: Unexpected token ... at createScript (vm.js:53:10) at Object.runInThisContext (vm.js:95:10) at Module._compile (module.js:543:28)

I'd rather address the first issue without having a custom configuration, but perhaps the second issue gives you a clue?

Thanks.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the README migration steps and reproduce the server-side loading failure involving react-datepicker/dist/react-datepicker.css. Then inspect the default config-overrides.js and the reported Babel syntax error. Done means the migrated CRA app starts and loads SSR without either compilation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, javascript, react, webpack
Domain
build-system, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.