accordproject / concerto

Business schema language and runtime
https://concerto.accordproject.org
Apache License 2.0
109 stars 99 forks source link

Standalone browser versions of all libraries #415

Open sstone1 opened 2 years ago

sstone1 commented 2 years ago

Currently, several modules have UMD versions generated using Webpack:

https://github.com/accordproject/concerto/blob/b05be1d6b619fcadd098b538b85895149ab6ac1d/packages/concerto-core/package.json#L14 https://github.com/accordproject/concerto/blob/b05be1d6b619fcadd098b538b85895149ab6ac1d/packages/concerto-tools/package.json#L13

Only concerto-core has the browser key set though.

However, in order to get this library integrated into a React application, I had to add the following polyfills and globals:

const webpack = require('webpack');

module.exports = function override(config) {
  const fallback = config.resolve.fallback || {};
  Object.assign(fallback, {
    path: require.resolve('path-browserify'),
    fs: require.resolve('browserify-fs'),
    url: require.resolve('url/'),
    util: require.resolve('util/'),
    os: require.resolve('os-browserify'),
    stream: require.resolve('stream-browserify'),
    buffer: require.resolve('buffer/'),
    // crypto: require.resolve('crypto-browserify'),
    process: require.resolve('process/browser'),
  });
  config.resolve.fallback = fallback;
  const plugins = config.plugins || [];
  plugins.push(
    new webpack.ProvidePlugin({
      Buffer: ['buffer', 'Buffer'],
      process: ['process'],
    })
  );
  config.plugins = plugins;
  return config;
};

This may be as simple as ensuring that all of our modules include UMD generated versions, rather than anything wrong with the Webpack configuration.

utkarsh-shrivastav77 commented 1 year ago

Hi, is this issue still open

alaykabir commented 8 months ago

Hi, Can I work on this issue? I have decent experience in this tech-stack. So, Please can you assign it to me?

vivek-anand-singh commented 1 month ago

I would like to request yout to assign this issue to me related to integrating the concerto library modules into a React application.

Issue Summary: Several concerto modules (such as concerto-core and concerto-tools) require UMD versions generated using Webpack for browser compatibility. Currently, only concerto-core has the browser key set. To integrate these modules into a React application, additional polyfills and global variables are necessary due to missing Node.js core modules in the browser environment.

My Solution: To resolve this issue, I plan to:

  1. Ensure that all concerto modules include UMD-generated versions.
  2. Modify the Webpack configuration to add necessary polyfills and globals for Node.js core modules.

I am confident that this approach will ensure seamless integration of the concerto modules into the React application. Please let me know if you need any additional information or have any concerns regarding this request.