Open MrBokeh opened 5 years ago
What does your workflow look like when you use RiveScript with Angular?
Webpack is commonly used for bundling a JavaScript app for web browsers (creating a single bundled.min.js script to include in your HTML), and before that, Browserify was one people used. RiveScript-js used those to produce the dist/rivescript.js bundle for easy web browser embedding, and both of these tools would set the process.browser
variable for run-time detection in the script.
The raw Node.js sources for RiveScript aren't suitable for a browser (no require()
keyword supported), so your workflow must be doing something to bundle them? If so there might be a way to auto-detect it that RiveScript could use instead.
I do like the idea of a constructor option fallback just in case, but curious to hear what you're doing with Angular and RiveScript.
Auto-detect is a nice feature but in some cases for some frontend projects that do not use Webpack nor Browserify for bundling and run their npm packages would have troubles to run. I use TypeScript which is the default standard language for both Angular and React but it does not use Webpack nor Browserify, so it would be very nice to have a fallback option.
[feature request] manual select between browser and nodejs mode when create new RiveScripr object to allow any front end library like angular which use npm to import module would work nicely.
E.g. const rivescript = new RiveScript({mode:”browser”});