Doesn't work with browserify?
See original GitHub issueCannot 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:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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:
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).
@nikgraf Sure, Iād do that ! š