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

v3.0.0-1 (beta) wont work with webpack + using 'new Readmore('...') #237

Closed
Chrisser73 opened this issue Apr 24, 2019 · 4 comments
Closed
Assignees
Labels

Comments

@Chrisser73
Copy link

I tried to update from 2.2.1 to 3.0x because of the unsolved issue:
#233

I've installed it like the description said:
https://github.com/jedfoster/Readmore.js/tree/version-3.0

What I've recognized was, that there is no ./src/.. folder after the install, only a /dist-Folder wehre the readmore.js is inside but the Readmore.js sais:
__webpack_require__(/*! ./src/readmore.js */"./src/readmore.js");
??

Then i used:
require('readmore-js');
also like in the description... (even though the folder structure is now different then in 2.2.1)

Anyway followed the instruction when i have to use:
new Readmore('article');
but it wont work, because it could not find "Readmore", because its not there, because it could not include readmore.js because of the missing src folder.

Even if i try to insert the src folder manually, trying to use new Readmore() in any different and possible way or something else it wont work!

For me, V3 is broken or tell me whats wrong pls.
Thank you

@pammel
Copy link

pammel commented Apr 25, 2019

This way it worked for me with webpack (3.0.0-beta-1):

const Readmore = require('readmore-js');
global.Readmore = Readmore;

Then you have to call it with:

new Readmore.default('article');

@jedfoster
Copy link
Owner

Good catch. That's bug in the documentation.

Should be more like what @pammel showed:

const Readmore = require('readmore-js');

new Readmore('article');

@jedfoster jedfoster added the bug label May 31, 2019
@jedfoster jedfoster self-assigned this May 31, 2019
@Chrisser73
Copy link
Author

thank you, an there where also missing type definitions for typescript in my project :s

@decadence
Copy link

Works for me like this:

const Readmore = require('readmore-js').default;

// or
import Readmore from 'readmore-js';

// call
new Readmore('article');

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

No branches or pull requests

4 participants