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

Incompatibility with create-react-app #804

Open
JDWong-wag opened this issue Feb 26, 2018 · 3 comments
Open

Incompatibility with create-react-app #804

JDWong-wag opened this issue Feb 26, 2018 · 3 comments

Comments

@JDWong-wag
Copy link

How does one use Globalize and the DateTimePicker from react-widgets with create-react-app?

From an empty project:

npx create-react-app

my package.json

{
  "name": "test-globalize",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "cldr-data": "latest",
    "globalize": "^1.3.0",
    "iana-tz-data": ">=2017.0.0",
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-scripts": "1.1.1",
    "react-widgets-globalize": "^5.0.0"
  },
  "cldr-data-urls-filter": "(core|dates|numbers|units)",
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

my index.js

import React from 'react';
import ReactDOM from 'react-dom';
import Globalize from 'globalize';
import globalizeLocalizer from 'react-widgets-globalize';

import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';

Globalize.locale('en');

globalizeLocalizer();


ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();

Produces the errror:

Failed to compile.

./node_modules/globalize/dist/globalize.js
Module not found: Can't resolve 'cldr' in '/Users/jd/sandbox/test-globalize/node_modules/globalize/dist'

For some reason globalize will not compile, and index.js doesn't get run. Is there a fix without ejecting?

@swyxio
Copy link

swyxio commented Apr 27, 2018

nope. #603

@timarney
Copy link

FYI - For create-react-app you might try https://github.com/timarney/react-app-rewired let's you mod the webpack config without ejecting (might do the trick).

@metaclass-nl
Copy link

Maybe https://github.com/metaclass-nl/switch-language-example-globalize could be interesting for this. But i did not yet look at https://github.com/timarney/react-app-rewired, thanks @timarney!

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

No branches or pull requests

4 participants