PromucFlow_constructor/app/shared/ast/rollup.config.js
Ayangade Adeoluwa 9566e54a19
fix: fix package.json file for ast build (#22119)
This issue fixes RTS build failure due to `(node:3527) [DEP0128]
DeprecationWarning: Invalid 'main' field in @shared/ast`. More
information can be found
[here](https://nodejs.org/api/deprecations.html#dep0128-modules-with-an-invalid-main-entry-and-an-indexjs-file).

The bug here was that, when the ast package was built, we were not
updating the package.json of the build to point to index.js directly,
instead it was pointing to `build/index.js`. This was not a problem in
nodejs 14, However new versions of nodejs requires we drop the "build/"
and simply make it `index.js`.

Before:
<img width="694" alt="Screenshot 2023-04-05 at 08 14 15"
src="https://user-images.githubusercontent.com/37867493/230008234-8fc9537a-e94f-4477-a4a5-8a7e857d481b.png">

After: 
<img width="694" alt="Screenshot 2023-04-05 at 08 14 29"
src="https://user-images.githubusercontent.com/37867493/230008259-be3bcee0-e68c-4240-b330-8fe49fda95d5.png">


Fixes #22118

- Bug fix (non-breaking change which fixes an issue)

- Manual

### Test Plan
> Add Testsmith test cases links that relate to this PR

### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)


## Checklist:
### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-04-05 14:14:36 +05:30

37 lines
922 B
JavaScript

import peerDepsExternal from "rollup-plugin-peer-deps-external";
import commonjs from "@rollup/plugin-commonjs";
import typescript from "rollup-plugin-typescript2";
import generatePackageJson from "rollup-plugin-generate-package-json";
const packageJson = require("./package.json");
export default {
// TODO: Figure out regex where each directory can be a separate module without having to manually add them
input: ["./index.ts"],
output: [
{
file: packageJson.module,
format: "esm",
sourcemap: true,
},
{
file: packageJson.main,
format: "cjs",
sourcemap: true,
},
],
plugins: [
peerDepsExternal(),
commonjs(),
typescript({ useTsconfigDeclarationDir: true }),
generatePackageJson({
baseContents: (pkg) => ({
...pkg,
main: "index.js",
module: "index.es.js",
types: "index.d.ts",
}),
}),
],
};