Skip to content
This repository was archived by the owner on Feb 25, 2019. It is now read-only.

Add support for Webpack's NodeJS targets#84

Open
ryan-codingintrigue wants to merge 2 commits intoanvilresearch:masterfrom
ryan-codingintrigue:master
Open

Add support for Webpack's NodeJS targets#84
ryan-codingintrigue wants to merge 2 commits intoanvilresearch:masterfrom
ryan-codingintrigue:master

Conversation

@ryan-codingintrigue
Copy link

I know the README says Not for use in Webpack, but Webpack isn't only used for outputting browser code. When using a target other than web (NodeJS, Electron, etc.) there's no reason this library shouldn't be able to be bundled using Webpack too.

The reason it doesn't work is because of this block of code:

desiredType = require(registeredAlgorithms[algName])

Webpack doesn't handle dynamic require very well.

This PR addresses the issue by turning the registeredAlgorithms into a factory function, rather than a path, allowing Webpack to effectively track which files should be bundled. This will allow users to use Webpack for any NodeJS target

Use hardcoded paths for require'd algorithm dependencies
Replace Webpack section in README with new information
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant