abinavseelan / react-input-trigger

React component for handling character triggers inside textareas and input fields. 🐼
MIT License
88 stars 20 forks source link

npm package has src version #1

Closed goldylucks closed 6 years ago

goldylucks commented 6 years ago

after I run $ yarn add react-input-trigger, I've ended up with this:

image

I got the dev build instead the prod build. Please fix so I can use this cool package :)

as a workaround for now I've copy pasted the package into my source code, and it works

abinavseelan commented 6 years ago

@goldylucks

This is curious. 🤔 Can you give me some more details on how you're packaging your application - Node version, webpack version, .babelrc? 🙂

goldylucks commented 6 years ago

does it matter?

I've installed the package thru yarn, and in package.json, the main entry point is src/index.js, and there's no build/dist folder.

Created a fresh repo to reproduce :)

abinavseelan commented 6 years ago

Ah! I get it now. 🙂

Right ... so the thought-process I had while building this was that it would stay in its source version, and that I would leave the bundling to the user. Basically provide everything as is.

Just out of curiosity, how are you bundling it? 🙂 I spun this component off from a project that I worked on. In that project, importing this component and running the project source through webpack with babel-preset-react and babel-preset-env worked without any errors.

Would like to know how you're bundling this so that I can see how others are using this package and if, like you pointed out, the dist/build version makes more sense than the source version. 😄

goldylucks commented 6 years ago

well that's how npm packages work. a downloadable package is expected to be pure .js production ready files. otherwise, leave it as a gist, codebin, or just the repo, but this is how packages are used:

  1. $ yarn add package-name
  2. import 'packageName' from 'package-name

Of course you won't have errors running it through babel, but babel is not supposed to be used in production.

Why not upload to npm the production ready version, like the rest of the world?

Help me understand your thought process here :)

abinavseelan commented 6 years ago

@goldylucks

Why not upload to npm the production ready version, like the rest of the world?

Yeah. You're probably right. Will fix this in a day or two. 🙂

I just figured that since this is a component that you'd pull into a react application, the build process that the end-user runs before production would suffice. But apparently I assumed incorrectly.

Thanks for raising this. 😄

ltdat287 commented 6 years ago

I have same error. Please fix it.

rheaditi commented 6 years ago

Hey, @goldylucks @ltdat287! 👋

We've updated the publishing process in v.1.1.0.

Do try the new version and let us know if it fixes your issues. 🙂

Marking this issue as closed. 😄

goldylucks commented 6 years ago

I ended up making more changes, don't remember exactly why, you are welcome to have a look and ask any Qs.