From cb307ea03d11140e10d6e0f03c9cf3873b184899 Mon Sep 17 00:00:00 2001 From: Zishan Ahmad Date: Tue, 9 Jul 2024 22:42:11 +0530 Subject: [PATCH 1/2] disabled eslint in dist --- packages/ui-elements/.eslintignore | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/ui-elements/.eslintignore b/packages/ui-elements/.eslintignore index 3d9e4d531..1ee3a4269 100644 --- a/packages/ui-elements/.eslintignore +++ b/packages/ui-elements/.eslintignore @@ -1,2 +1,3 @@ rollup.config.js *.test.js +dist/ \ No newline at end of file From a16b4c532876a0942bdaf5a8f2e83c1c53b4c098 Mon Sep 17 00:00:00 2001 From: Zishan Ahmad Date: Tue, 9 Jul 2024 23:51:28 +0530 Subject: [PATCH 2/2] added preserveModule --- packages/markups/package.json | 1 - packages/markups/rollup.config.js | 19 +++++++++++-------- packages/react/package.json | 2 +- packages/ui-elements/package.json | 3 +-- packages/ui-elements/rollup.config.js | 19 +++++++++++-------- packages/ui-kit/package.json | 3 +-- packages/ui-kit/rollup.config.js | 19 +++++++++++-------- yarn.lock | 3 --- 8 files changed, 36 insertions(+), 33 deletions(-) diff --git a/packages/markups/package.json b/packages/markups/package.json index 768084723..3b09bc97f 100644 --- a/packages/markups/package.json +++ b/packages/markups/package.json @@ -58,7 +58,6 @@ "rimraf": "^5.0.1", "rollup": "^2.70.1", "rollup-plugin-analyzer": "^4.0.0", - "rollup-plugin-bundle-size": "^1.0.3", "rollup-plugin-dts": "^6.1.1", "rollup-plugin-peer-deps-external": "^2.2.4", "rollup-plugin-postcss": "^4.0.2", diff --git a/packages/markups/rollup.config.js b/packages/markups/rollup.config.js index 1d6ef7109..c909076ca 100644 --- a/packages/markups/rollup.config.js +++ b/packages/markups/rollup.config.js @@ -4,13 +4,11 @@ import babel from '@rollup/plugin-babel'; import postcss from 'rollup-plugin-postcss'; import external from 'rollup-plugin-peer-deps-external'; import json from '@rollup/plugin-json'; -import bundleSize from 'rollup-plugin-bundle-size'; import { terser } from 'rollup-plugin-terser'; import replace from '@rollup/plugin-replace'; import analyze from 'rollup-plugin-analyzer'; import dts from 'rollup-plugin-dts'; -const packageJson = require('./package.json'); const PRODUCTION = process.env.NODE_ENV === 'production'; export default [ @@ -18,15 +16,21 @@ export default [ input: 'src/index.js', output: [ { - file: packageJson.main, + dir: 'dist/cjs', format: 'cjs', - sourcemap: true, + sourcemap: 'hidden', + preserveModules: true, + preserveModulesRoot: 'src', plugins: [PRODUCTION && terser()], + exports: 'auto', }, + { - file: packageJson.module, + dir: 'dist/esm', format: 'esm', - sourcemap: true, + sourcemap: 'hidden', + preserveModules: true, + preserveModulesRoot: 'src', plugins: [PRODUCTION && terser()], }, ], @@ -63,14 +67,13 @@ export default [ limit: 20, summaryOnly: true, }), - bundleSize(), ], }, { input: 'src/index.js', output: { - file: packageJson.types, + file: 'dist/esm/index.d.ts', format: 'es', }, plugins: [dts()], diff --git a/packages/react/package.json b/packages/react/package.json index 3fd024422..26dd7d84b 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -13,7 +13,7 @@ ], "scripts": { "prebuild": "rimraf dist", - "build": "rollup -c --context=window --environment NODE_ENV:production", + "build": "yarn prebuild && rollup -c --context=window --environment NODE_ENV:production", "watch": "rollup -c --watch --context=window", "test:lint": "eslint src/**/*.js", "format": "prettier --write 'src/' ", diff --git a/packages/ui-elements/package.json b/packages/ui-elements/package.json index b51d05bb4..5e418bf2b 100644 --- a/packages/ui-elements/package.json +++ b/packages/ui-elements/package.json @@ -14,7 +14,7 @@ ], "scripts": { "prebuild": "rimraf dist", - "build": "rollup -c --context=window --environment NODE_ENV:production", + "build": "yarn prebuild && rollup -c --context=window --environment NODE_ENV:production", "watch": "rollup -c --watch --context=window", "test:lint": "eslint src/**/*.js", "format": "prettier --write 'src/' ", @@ -70,7 +70,6 @@ "rimraf": "^5.0.1", "rollup": "^2.70.1", "rollup-plugin-analyzer": "^4.0.0", - "rollup-plugin-bundle-size": "^1.0.3", "rollup-plugin-dts": "^6.1.1", "rollup-plugin-peer-deps-external": "^2.2.4", "rollup-plugin-postcss": "^4.0.2", diff --git a/packages/ui-elements/rollup.config.js b/packages/ui-elements/rollup.config.js index 8894532b4..f3cb74436 100644 --- a/packages/ui-elements/rollup.config.js +++ b/packages/ui-elements/rollup.config.js @@ -4,13 +4,11 @@ import babel from '@rollup/plugin-babel'; import postcss from 'rollup-plugin-postcss'; import external from 'rollup-plugin-peer-deps-external'; import json from '@rollup/plugin-json'; -import bundleSize from 'rollup-plugin-bundle-size'; import { terser } from 'rollup-plugin-terser'; import replace from '@rollup/plugin-replace'; import analyze from 'rollup-plugin-analyzer'; import dts from 'rollup-plugin-dts'; -const packageJson = require('./package.json'); const PRODUCTION = process.env.NODE_ENV === 'production'; export default [ @@ -18,15 +16,21 @@ export default [ input: 'src/index.js', output: [ { - file: packageJson.main, + dir: 'dist/cjs', format: 'cjs', - sourcemap: true, + sourcemap: 'hidden', + preserveModules: true, + preserveModulesRoot: 'src', plugins: [PRODUCTION && terser()], + exports: 'auto', }, + { - file: packageJson.module, + dir: 'dist/esm', format: 'esm', - sourcemap: true, + sourcemap: 'hidden', + preserveModules: true, + preserveModulesRoot: 'src', plugins: [PRODUCTION && terser()], }, ], @@ -58,14 +62,13 @@ export default [ limit: 20, summaryOnly: true, }), - bundleSize(), ], }, { input: 'src/index.js', output: { - file: packageJson.types, + file: 'dist/esm/index.d.ts', format: 'es', }, plugins: [dts()], diff --git a/packages/ui-kit/package.json b/packages/ui-kit/package.json index 3511efffe..f9c84254b 100644 --- a/packages/ui-kit/package.json +++ b/packages/ui-kit/package.json @@ -14,7 +14,7 @@ ], "scripts": { "prebuild": "rimraf dist", - "build": "rollup -c --context=window --environment NODE_ENV:production", + "build": "yarn prebuild && rollup -c --context=window --environment NODE_ENV:production", "watch": "rollup -c --watch --context=window", "test:lint": "eslint src/**/*.js", "format": "prettier --write 'src/' ", @@ -60,7 +60,6 @@ "rimraf": "^5.0.1", "rollup": "^2.70.1", "rollup-plugin-analyzer": "^4.0.0", - "rollup-plugin-bundle-size": "^1.0.3", "rollup-plugin-dts": "^6.1.1", "rollup-plugin-peer-deps-external": "^2.2.4", "rollup-plugin-postcss": "^4.0.2", diff --git a/packages/ui-kit/rollup.config.js b/packages/ui-kit/rollup.config.js index fa5390c92..6208a3edf 100644 --- a/packages/ui-kit/rollup.config.js +++ b/packages/ui-kit/rollup.config.js @@ -4,13 +4,11 @@ import babel from '@rollup/plugin-babel'; import postcss from 'rollup-plugin-postcss'; import external from 'rollup-plugin-peer-deps-external'; import json from '@rollup/plugin-json'; -import bundleSize from 'rollup-plugin-bundle-size'; import { terser } from 'rollup-plugin-terser'; import replace from '@rollup/plugin-replace'; import analyze from 'rollup-plugin-analyzer'; import dts from 'rollup-plugin-dts'; -const packageJson = require('./package.json'); const PRODUCTION = process.env.NODE_ENV === 'production'; export default [ @@ -18,15 +16,21 @@ export default [ input: 'src/index.js', output: [ { - file: packageJson.main, + dir: 'dist/cjs', format: 'cjs', - sourcemap: true, + sourcemap: 'hidden', + preserveModules: true, + preserveModulesRoot: 'src', plugins: [PRODUCTION && terser()], + exports: 'auto', }, + { - file: packageJson.module, + dir: 'dist/esm', format: 'esm', - sourcemap: true, + sourcemap: 'hidden', + preserveModules: true, + preserveModulesRoot: 'src', plugins: [PRODUCTION && terser()], }, ], @@ -64,14 +68,13 @@ export default [ limit: 20, summaryOnly: true, }), - bundleSize(), ], }, { input: 'src/index.js', output: { - file: packageJson.types, + file: 'dist/esm/index.d.ts', format: 'es', }, plugins: [dts()], diff --git a/yarn.lock b/yarn.lock index 0171e4e34..bab4af45c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2311,7 +2311,6 @@ __metadata: rimraf: ^5.0.1 rollup: ^2.70.1 rollup-plugin-analyzer: ^4.0.0 - rollup-plugin-bundle-size: ^1.0.3 rollup-plugin-dts: ^6.1.1 rollup-plugin-peer-deps-external: ^2.2.4 rollup-plugin-postcss: ^4.0.2 @@ -2513,7 +2512,6 @@ __metadata: rimraf: ^5.0.1 rollup: ^2.70.1 rollup-plugin-analyzer: ^4.0.0 - rollup-plugin-bundle-size: ^1.0.3 rollup-plugin-dts: ^6.1.1 rollup-plugin-peer-deps-external: ^2.2.4 rollup-plugin-postcss: ^4.0.2 @@ -2574,7 +2572,6 @@ __metadata: rimraf: ^5.0.1 rollup: ^2.70.1 rollup-plugin-analyzer: ^4.0.0 - rollup-plugin-bundle-size: ^1.0.3 rollup-plugin-dts: ^6.1.1 rollup-plugin-peer-deps-external: ^2.2.4 rollup-plugin-postcss: ^4.0.2