Skip to content

fengari doesn't work with webpack when targetting browser - dependency on fs #156

@roddypratt

Description

@roddypratt

I'm using fengari-web without problems in a browser-side app bundled with webpack 3. When I try pulling in fengari API calls directly, I get these kind of errors.

ERROR in ./node_modules/fengari/src/lauxlib.js
Module not found: Error: Can't resolve 'fs' in 'C:\rascular\WebCentre2\node_modules\fengari\src'
 @ ./node_modules/fengari/src/lauxlib.js 901:15-28
 @ ./node_modules/fengari/src/fengari.js

It seems to be because the conditional if (typeof process !== "undefined") require()s aren't handled by webpack, and the recommended solution seems to be to use __non_webpack_require__

https://hackernoon.com/building-isomorphic-javascript-packages-1ba1c7e558c5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions