EdgeVerve / feel

Expression Language for creating and executing business rules in decision table based on DMN 1.1 specification for conformance level 3
MIT License
93 stars 48 forks source link

Webpack #12

Closed richardmward closed 3 years ago

richardmward commented 6 years ago

Hi,

Does anyone have any experience of using this with webpack? I'm struggling with all manner of dependency issues from xlsx, cptable, dtrace-provider, source-map-support (which can mostly be circumvented with marking them as externals as I don't need the decision table bit, just the feel parser) and requires in external-function are expressions. I guess this just isn't designed to be used with webpack, which is fair enough - but just asking on the off chance someone has done any work on it?

deostroll commented 5 years ago

Hi. Sorry for the late response.

I had run into a similar issue long back. I was trying to make a designer for composing decision graphs. In the process, it seemed natural to have the feel parser logic shared between server and client. I had used webpack then. But I never got around to fixing the webpack problem.

Don't remember what I did. But I am pretty sure there was a server side software that took care of that aspect. Hence that logic was not shared, and consequently not part of the browser client module I was trying to build.

So really sorry I can't help you here with the webpack config. We hope you find a solution.

richardmward commented 4 years ago

Ended up finding myself back here a little over 2 years later 😄, so thought I'd just note what I have done to get this working in a browser:

Webpack config

plugins: [
    // Removes a critical warning about dynamic dependencies, as it is
    // only relevant to "external functions", which we don't need to use.
    new webpack.ContextReplacementPlugin(/js-feel/, (data) => {
        delete data.dependencies[0].critical;
        return data;
    }),
    // None of these are required for the standalone bit of js-feel to work,
    // so we can safely just ignore them.
    new webpack.IgnorePlugin(/source-map-support|dtrace-provider|xlsx/)
]

Initialisation

// Configure js feel to use the browser console for logging, rather than bunyan
const jsFeel = require("js-feel")();
jsFeel.init({ logger: () => console })
const { feel } = jsFeel;