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

Create tiny-slider.module.js #39

Merged
merged 1 commit into from
May 16, 2017
Merged

Create tiny-slider.module.js #39

merged 1 commit into from
May 16, 2017

Conversation

tzsk
Copy link
Contributor

@tzsk tzsk commented May 10, 2017

this is the fix for the Issue with Webpack module loading with React, i.e. #20

Now. from a React Component it is to be imported like below:

import tns from 'tiny-slider/dist/tiny-slider.module'

And inside the React Component it can be used as the documentation suggested.

Ex:

tns({
    ...
});

@ganlanyuan
Copy link
Owner

ganlanyuan commented May 10, 2017

Thanks @tzsk ,
May I know the details of the fix?

  1. Change function name from tns to tinySlider
  2. export default tinySlider at the end
    Right?

So you tried to import "/src/tiny-slider.module.js", and it's not working?

@tzsk
Copy link
Contributor Author

tzsk commented May 11, 2017

@ganlanyuan Yes. That's exactly the change I've made and it is working now.
I've tested it with create-react-app and react-webpack-redux

But strangely the /src/tiny-slider.module.js is not working with any of them.

The thing that is bugging me is that, I've also tested it with Angular 2/4 and for that, the new file is not working but the old file i.e. src/tiny-slider.module.js is working fine.

@ganlanyuan
Copy link
Owner

ganlanyuan commented May 11, 2017 via email

@chadspencer
Copy link

Is this PR ready to merge? I would love to have the npm package updated so I can start using the module.

@ganlanyuan ganlanyuan merged commit f81002f into ganlanyuan:master May 16, 2017
@ganlanyuan
Copy link
Owner

Merge it for now.

@chadspencer
Copy link

Thanks so much @ganlanyuan. Can you publish the npm package as well?

@ganlanyuan
Copy link
Owner

v1.5.1 was published.

@tzsk
Copy link
Contributor Author

tzsk commented May 16, 2017

@ganlanyuan Sorry for the late response. But I was looking for other solutions to make it work other than using two separate file for React and Angular 2. And I have found something. In the new way we don't need the new file that I have created. And both Angular 2 and React can use the same file and the API Docs that you wrote in README.md doesn't need to change.

In the new way we can call the file the same way as the docs suggest.

import { tns } from 'tiny-slider/src/tiny-slider.module'

I'll post the PR right away.

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

Successfully merging this pull request may close these issues.

3 participants