Giter Site home page Giter Site logo

vaadin / base-starter-react Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 4.0 284 KB

Base Starter for Vaadin components with ReactJS

Home Page: https://vaadin.com/start

HTML 24.75% CSS 1.17% JavaScript 74.09%
react reactjs starter-project vaadin vaadin-elements webcomponents

base-starter-react's Introduction

base-starter-react's People

Contributors

amahdy avatar artur- avatar johannesh2 avatar juhopiirainen avatar limonte avatar macjuan avatar pekam avatar platosha avatar tomivirkki avatar web-padawan avatar yuriy-fix avatar zch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

base-starter-react's Issues

p3-preview is unbuildable. Vaadin components on npm are unusable in React apps.

How to verify

  1. Take a checkout
  2. Switch to p3-preview branch
  3. run yarn build
  4. Output:
yarn run v1.7.0
$ react-scripts build
Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

 	./node_modules/@polymer/polymer/lib/utils/mixin.js:13

Read more here: http://bit.ly/2tRViJ9

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reasons behind the failure

This is because parts of polymer (and maybe Vaadin) is not precompiled to ES5 before they are released under npm and react-scripts 1.0 does not want to compile modules to minify them, due to the risk of breaking something.

This is a problem with all react projects, not just our starter. Even if you create a react project from scratch and just add say to it, then it will fail in this manner.

Updating to react-scripts 2.0

They have made a change in policy in react-scripts 2.0 and now they build them to minify. With 2.0, yarn build passes. However at runtime when testing the built version, the web components won't work and you have a huge amount of exceptions in the console.

Steps to test with react-scripts 2.0

I will create a new app from scratch with react-scripts 2.0 and add vaadin-date-picker from npm to it. Nothing else.

  1. npx create-react-app@next --scripts-version=2.0.0-next.66cc7a90 react-scripts-2-test
  2. cd react-scripts-2-test
  3. yarn add @vaadin/vaadin-date-picker
  4. Edit src/App.js and add import '@vaadin/vaadin-date-picker' and <vaadin-date-picker></vaadin-date-picker>
  5. yarn start. The component works! (the theme is very off and the component is barely visible, but that is another issue)
  6. yarn build. Passes without issues.
  7. serve -s build App loads up, everything except the date picker is there. There is a barrage of errors in the console, where of 30 first ones are this:
Uncaught DOMException: custom element constructors must call super() first and must not return a different object
    at Object.<anonymous> (http://localhost:5000/static/js/main.e9a02274.js:1:9728)

Additionally there is these two.

Uncaught (in promise) TypeError: Illegal invocation
    at t.value (custom-style.js:81)

Uncaught TypeError: Illegal invocation
    at t.value (custom-style.js:81)

Summary

I have no way to deploy my app anywhere. I can't put it up anywhere without the build so I can only show my app on my personal computers. You can't do anything other that development with React and Vaadin Components on npm, so the combo provides zero business or other kind of value.

P3 preview branch build is failing

The same as vaadin/base-starter-vue#13

$ yarn build
yarn run v1.9.4
$ react-scripts build
Creating an optimized production build...
Failed to compile.

Failed to minify the code from this file:

 	./node_modules/@polymer/polymer/lib/utils/mixin.js:13

Need to find out what is the problem in UglifyJS, possibly create small reproduction.

V11 starter does not start up when following /start instructions.

On https://vaadin.com/start/latest/react, the instructions to get the starter to use are the following.

  1. Extract zip
  2. Ensure yarn is installed
  3. yarn install
  4. yarn start

Following these instructions, you get a huge error on your screen when it is loaded in the browser, and the app is unusable.

Element ref was specified as a string (text) but no owner was set. This could happen for one of the following reasons:

  1. You may be adding a ref to a functional component
  2. You may be adding a ref to a component that was not created inside a component's render method
  3. You have multiple copies of React loaded
    See https://fb.me/react-refs-must-have-owner for more information.

This can be fixed with an bower install between 3 and 4.

Furthermore, the README.md has another list of instructions.

  1. install bower
  2. npm install
  3. bower install
  4. npm start

These instructions work out of the box.

Please choose one set of instructions that work, and put the same set in both the README and /start/latest/react

(and other versions than latest if they are broken as well).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.