Skip to content
This repository was archived by the owner on Jul 12, 2025. It is now read-only.

process.env.FOLKTALE_DOCS is not replaced by Webpack 5 #229

@cdoublev

Description

@cdoublev

By default Webpack 5 only replace process.env.NODE_ENV when bundling. But Folktale uses process.env.FOLKTALE_DOCS and process.env.FOLKTALE_ASSERTIONS in three distribution files. When executed, those bundled files throws an error because process is undefined.

Steps to reproduce

It can be reproduced by bundling with Webpack 5 a file that contains eg. Task.of().

Expected behaviour

Run the bundle without throwing an error.

Observed behaviour

The bundled file throws an error because process is undefined.

Environment

  • OS: Debian Buster
  • JavaScript VM: V8 (NodeJS 15)
  • Folktale version: 2.3.0

Additional information

It can be fixed by adding plugins: [new webpack.EnvironmentPlugin({ FOLKTALE_DOCS: false })] in the Webpack configuration file. This could be documented in the Folktale documentation.

Or FOLKTALE_DOCS and FOLKTALE_ASSERTIONS can be moved/nested as object properties in process.env.NODE_ENV, but I'm aware that browsers are not necessary the main platform target of this library, therefore this change might not be worth it. However, and to answer this comment (what most users of the library are interested in seeing), this change could lower the barrier of entry for adopting Folktale, which I should say is IMHO the best FP ADT library I found and use since a few years now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions