Skip to content

Commit 9bcd9ea

Browse files
authored
Merge pull request #187 from larsroettig/reduce-bundlesize
Add parcel to reduce the bundle size
2 parents bcede80 + eb4ebdd commit 9bcd9ea

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.DS_Store
2+
.parcel-cache
23
**/junit.xml
34
npm-debug.log
45
yarn-error.log
@@ -11,3 +12,4 @@ test-types.js
1112
docs/build/
1213
yarn.lock
1314
package-lock.json
15+
.npmrc

package.json

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
"sdk",
1313
"bindings"
1414
],
15-
"main": "lib/index.js",
16-
"types": "lib/index.d.ts",
15+
"source": "src/index.ts",
16+
"main": "dist/main.js",
17+
"types": "dist/index.d.ts",
1718
"files": [
1819
"lib",
1920
"src",
@@ -23,7 +24,8 @@
2324
"scripts": {
2425
"test": "jest",
2526
"test:junit": "jest --ci --reporters=default --reporters=jest-junit",
26-
"build": "rimraf lib/* && tsc && mv lib/src/* lib && rimraf lib/package.json lib/src lib/*.test.*",
27+
"build": "parcel build",
28+
"build:analyze": "parcel build --reporter @parcel/reporter-bundle-analyzer",
2729
"lint": "tslint -p tsconfig.json 'src/**/*.ts*'",
2830
"lint:all": "npm run lint",
2931
"check-typescript": "tsc",
@@ -38,6 +40,9 @@
3840
},
3941
"homepage": "https://github.com/launchdarkly/react-client-sdk",
4042
"devDependencies": {
43+
"@parcel/packager-ts": "2.8.3",
44+
"@parcel/reporter-bundle-analyzer": "^2.8.3",
45+
"@parcel/transformer-typescript-types": "2.8.3",
4146
"@testing-library/jest-dom": "^5.16.4",
4247
"@testing-library/react": "^13.0.1",
4348
"@types/hoist-non-react-statics": "^3.3.1",
@@ -51,10 +56,9 @@
5156
"jest-environment-jsdom": "^27.4.4",
5257
"jest-environment-jsdom-global": "^3.0.0",
5358
"jest-junit": "^13.0.0",
59+
"parcel": "^2.8.3",
5460
"prettier": "^1.18.2",
5561
"prop-types": "^15.7.2",
56-
"react": "^18.0.0",
57-
"react-dom": "^18.0.0",
5862
"react-test-renderer": "^18.0.0",
5963
"rimraf": "^3.0.0",
6064
"ts-jest": "^27.1.1",
@@ -64,12 +68,27 @@
6468
"typescript": "^4.5.3"
6569
},
6670
"dependencies": {
71+
"@swc/helpers": "^0.4.14",
6772
"hoist-non-react-statics": "^3.3.2",
6873
"launchdarkly-js-client-sdk": "^3.1.2",
6974
"lodash.camelcase": "^4.3.0"
7075
},
7176
"peerDependencies": {
7277
"react": "^16.6.3 || ^17.0.0 || ^18.0.0",
7378
"react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0"
79+
},
80+
"targets": {
81+
"main": {
82+
"context": "browser",
83+
"outputFormat": "commonjs",
84+
"isLibrary": true,
85+
"optimize": true,
86+
"engines": {
87+
"browsers": [
88+
"> 0.5%, last 2 versions, not dead",
89+
"ie >= 11"
90+
]
91+
}
92+
}
7493
}
7594
}

0 commit comments

Comments
 (0)