Giter Site home page Giter Site logo

Comments (11)

Templarian avatar Templarian commented on June 22, 2024 1

@azdanov Usually I would say yes in a heartbeat, but I have it almost done. Definitely can look it over and make tweaks in a PR once I have it merged. 😄

from materialdesign-react.

Templarian avatar Templarian commented on June 22, 2024 1

@azdanov https://github.com/Templarian/MaterialDesign-React/blob/master/src/Icon.tsx

Not even tested or compiled yet. Just committing a rough draft. It's really close to your PR. Busy tonight working on some other stuff, but will have more time this weekend.

from materialdesign-react.

Templarian avatar Templarian commented on June 22, 2024 1

@azdanov Okay, so I've ran into a really dumb bug/issue. I can't get the propTypes to validate in a test project. VS Code clearly shows that they are required or not, but it doesn't throw an error in the browser in `mode=development'.

Basic example: <Icon /> Since path={} is required it should be throwing an error.

The propTypes are showing up in the compiled code. Tried to publish as dev for the Icon component it shows errors, but production removes errors. I assumed if the parent project was in dev that component would still report errors.

Kind of giving up for now and moving on to adding icons and will look into this shortly. Any help would be appreciated. Attached my sample app.

jsreact.zip
.

from materialdesign-react.

azdanov avatar azdanov commented on June 22, 2024 1

Add this to webpack.config.js:

externals: {
  react: "commonjs react",
  "prop-types": "commonjs prop-types"
}

from materialdesign-react.

Templarian avatar Templarian commented on June 22, 2024 1

Closing this and working on updating the build to use TSC with a new issue.

@azdanov Can you do a PR and add a contributors property to the package.json for yourself since you co-wrote this library.

from materialdesign-react.

azdanov avatar azdanov commented on June 22, 2024

Are PR's welcome for this?

from materialdesign-react.

Templarian avatar Templarian commented on June 22, 2024

ToDo: Need to add the types definition file to the package.json.

from materialdesign-react.

Templarian avatar Templarian commented on June 22, 2024

That worked. Awesome!

from materialdesign-react.

azdanov avatar azdanov commented on June 22, 2024

Probably same issue as React. Facebook still uses commonjs.

from materialdesign-react.

azdanov avatar azdanov commented on June 22, 2024

I'm wondering if webpack is needed. Since this is used in react, and probably with a build system (who still writes createElement?), then distributing es6 code is fine.

By itself tsc will transform typescript to javascript, and the rest is for the end-user to manage.

EDIT:

Forgot to mention some benefits:

  • Simpler build step
  • Bundle size is reduced (webpack bootstrap code)
  • Possibly enable tree-shaking if the library gets more features

from materialdesign-react.

Templarian avatar Templarian commented on June 22, 2024

Yea, the @mdi/js only uses tsc. Considered simplifying this build also. We only need an ES6 module for this lib, so probably a good idea.

from materialdesign-react.

Related Issues (20)

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.