Using packages that require 'fs'


#1

I have a very basic app that uses webpack, electron and babel, and I’v spent an entire day on trying to get this to work, but I can’t seem to get it to work.

The problem is that the calipers package requires “fs.open” and it can’t seem to find the fs module, using excludes on the transform-loader I’ve managed to get to not complain about fs being undefined, but then complains about a missing modules “.”

 {
                enforce: "post",
                exclude: /node_modules\/calipers/,
                loader:  "transform-loader?brfs"
}

The transform and the brfs is there because I will be needing to use react-canvas aswell later (and I’ve identified that to use react-canvas and electron I need brfs)

I’ve created a repo that shows it here:

once it works it should output
type: ‘jpeg’, pages: [ { height: 582, width: 817 } ] }
to the log