concerto icon indicating copy to clipboard operation
concerto copied to clipboard

Standalone browser versions of all libraries

Open sstone1 opened this issue 2 years ago • 3 comments

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.

sstone1 avatar Apr 11 '22 11:04 sstone1

Hi, is this issue still open

utkarsh-shrivastav77 avatar Jun 06 '23 07:06 utkarsh-shrivastav77

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

alaykabir avatar Jan 07 '24 15:01 alaykabir

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.

vivek-anand-singh avatar Jul 19 '24 05:07 vivek-anand-singh