PromucFlow_constructor/app/shared
Satish Gandham 83538ad74d
feat: Bundle optimization and first load improvements (#21667)
Co-authored-by: Ivan Akulov <mail@iamakulov.com>
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Ivan Akulov <iamakulov@outlook.com>
Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
Co-authored-by: somangshu <somangshu.goswami1508@gmail.com>
2023-05-11 10:56:03 +05:30
..
ast feat: Bundle optimization and first load improvements (#21667) 2023-05-11 10:56:03 +05:30
.gitignore fix: workflow for shared modules testing (#16778) 2022-09-30 18:36:25 +05:30
Readme.md feat: Bundle optimization and first load improvements (#21667) 2023-05-11 10:56:03 +05:30

Shared Dependencies

We wanted to share common logic with different applications within our repo, so we picked yarn workspaces as our approach to tackle this problem. Following are the way in which you can take advantage of the module sharing architecture.

Create a shared module

  1. Create a directory inside shared
  2. Inside the directory, create a package.json file, and set its name field to @shared/<name of the module>. For example, if the module is abc, the name field should be @shared/abc.
  3. Add the module code
  4. Add a postinstall script to build the module as needed, e.g.:
// shared/abc/package.json
{
  "name": "@shared/abc",
  "scripts": {
    "postinstall": "rollup -c"
  }
}

Install a shared module

Navigate to the directory where you want to use the module and run yarn add <module-name>.

For example, if the package.json name field is @shared/abc, run

yarn add @shared/abc