Skip to content

Commit d434781

Browse files
committed
chore: refactor package.json to remove buildformats from it
1 parent a57422e commit d434781

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

package.json

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "react tooltip component",
55
"scripts": {
66
"dev-rollup": "node ./prebuild.js --env=development && node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.dev.js --watch",
7-
"build-rollup": "node ./prebuild.js --env=production && npm run types && node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.prod.js && npm run bundlesize",
7+
"build-rollup": "node ./prebuild.js --env=production && npm run types && node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.prod.js",
88
"dev": "node ./prebuild.js --env=development && node ./esbuild.config.dev.mjs",
99
"build": "node ./prebuild.js --env=production && node ./esbuild.config.prod.mjs",
1010
"types": "node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.types.js",
@@ -20,20 +20,6 @@
2020
},
2121
"main": "dist/react-tooltip.cjs.min.js",
2222
"module": "dist/react-tooltip.esm.min.js",
23-
"buildFormats": [
24-
{
25-
"file": "dist/react-tooltip.iife.js",
26-
"format": "iife"
27-
},
28-
{
29-
"file": "dist/react-tooltip.cjs.js",
30-
"format": "cjs"
31-
},
32-
{
33-
"file": "dist/react-tooltip.esm.js",
34-
"format": "es"
35-
}
36-
],
3723
"types": "dist/react-tooltip.d.ts",
3824
"license": "MIT",
3925
"private": false,

rollup.config.prod.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { nodeResolve } from '@rollup/plugin-node-resolve'
77
import ts from '@rollup/plugin-typescript'
88
import { terser } from 'rollup-plugin-terser'
99
import typescript from 'typescript'
10-
import pkg from './package.json'
1110

1211
const input = ['src/index.tsx']
1312

@@ -22,6 +21,21 @@ const globals = {
2221
'prop-types': 'PropTypes',
2322
}
2423

24+
const buildFormats = [
25+
{
26+
file: 'dist/react-tooltip.umd.js',
27+
format: 'umd',
28+
},
29+
{
30+
file: 'dist/react-tooltip.cjs.js',
31+
format: 'cjs',
32+
},
33+
{
34+
file: 'dist/react-tooltip.esm.js',
35+
format: 'es',
36+
},
37+
]
38+
2539
// splitted to be reusable by minified css build and unminified css
2640
const pluginsBeforePostCSS = [
2741
progress(),
@@ -74,14 +88,14 @@ const pluginsForCSSMinification = [
7488
...pluginsAfterPostCSS,
7589
]
7690

77-
const defaultOutputData = pkg.buildFormats.map(({ file, format }) => ({
91+
const defaultOutputData = buildFormats.map(({ file, format }) => ({
7892
file,
7993
format,
8094
plugins: [...plugins, filesize()],
8195
}))
8296

8397
// this step is just to build the minified css and es modules javascript
84-
const minifiedOutputData = pkg.buildFormats.map(({ file, format }) => ({
98+
const minifiedOutputData = buildFormats.map(({ file, format }) => ({
8599
file: file.replace('.js', '.min.js'),
86100
format,
87101
plugins: [...pluginsForCSSMinification, terser(), filesize()],

0 commit comments

Comments
 (0)