question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

Doesn't work with browserify?

See original GitHub issue
Cannot find module './ReactDefaultPerf' from '/Users/contra/Projects/project-name/node_modules/draft-js-hashtag-plugin/lib'

It looks like the output being published to npm is specifically meant to only work with webpack, because browserify hits these require statements and blows up.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

11reactions
yocontracommented, Mar 24, 2016

Ah, I identified the root cause - webpack replaces require() calls everywhere except for places with dead code apparently. Browserify sees these and tries to resolve them, then blows up. Solution is to use dead code elimination before publishing to npm, although webpack should probably be smarter about this.

Here is an example case:

image

Better yet, donā€™t use webpack? Each plugin is bundling every dependency (including react!) and ends up being huge. The bundle for a single draft-js plugin on npm is ~25000 lines of code. You should do ES6 -> ES5 before publishing but nothing else, let the users resolve their own dependencies with webpack or browserify or whatever they want. The build step for this repo is incredibly complex for what itā€™s doing (ES6->ES5 and some dead simple css pre-processing).

1reaction
varun-rajcommented, Jun 22, 2016

@nikgraf Sure, Iā€™d do that ! šŸ‘

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Browserify does not work - why? - Stack Overflow
This code will work out-of-the-box with Node, but your browser cannot interpret it. This is where Browserify is useful.
Read more >
Does not work with browserify Ā· Issue #150 Ā· nock/nock - GitHub
Since ClientRequest is an internal object not typically used in an application space, I'm filing this as a bug -- just because you're...
Read more >
Browserify - npm
You don't need to necessarily use the through module. Browserify is compatible with the newer, more verbose Transform streams built into Node v0Ā ......
Read more >
Browserify
Browserify lets you require('modules') in the browser by bundling up all of your dependencies. Install Documentation Ā· Source Code Ā· Help + Articles...
Read more >
Browserify Tutorial - Using require() In The Browser - YouTube
Learn how to use the require() function to import Javascript modules in the front-end part of your web application (in the browser) with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found