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.

Can not resolve 'fs' in module 'linebreak'

See original GitHub issue

The linebreaker require ‘fs’ from native Node.js:

# src/linebreaker.coffee
UnicodeTrie = require 'unicode-trie'
fs = require 'fs'
base64 = require 'base64-js'

But webpack seems not support native Node.js module:

ERROR in ./~/react-canvas/~/linebreak/src/linebreaker.js
Module not found: Error: Cannot resolve module 'fs' in /Users/rui/Sandbox/react-canvas-layout.test/node_modules/react-canvas/node_modules/linebreak/src
resolve module fs in /Users/rui/Sandbox/react-canvas-layout.test/node_modules/react-canvas/node_modules/linebreak/src

I am trying to use browserify instead of webpack.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
tuxracercommented, Jan 24, 2016

Got it. Well for others you’ll need to install the brfs transform.

npm install -g brfs
npm install --save-dev transform-loader brfs

Then add the brfs transform to your webpack config example

module: {
  postLoaders: [
    { loader: "transform?brfs" }
  ]
}
0reactions
BHouwenscommented, Jul 8, 2016

That’s the one yeah

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found: Error: Can't resolve 'fs' in - Stack Overflow
I found a possible solution, that you have to put some configuration in one of the node_modules. But I think that is not...
Read more >
module not found: error can t resolve 'fs react - You.com
Your quick fix is to take react scripts down to v4 until a fix for v5 is in place unless you are comfortable...
Read more >
cypress-io/cypress - Gitter
Module not found: Error: Can't resolve 'fs'. _. However when I run the same code as a node file, it does work without...
Read more >
[D] Can't resolve 'fs' : r/nextjs - Reddit
[D] Can't resolve 'fs'. Hey Guys,. I'm using firebase-admin in my project (i guess that's the source of issue). I'm only using that...
Read more >
API - esbuild
By default esbuild will not bundle the input files. ... All built-in node modules such as fs are automatically marked as external so...
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