Skip to content

Commit f97aef6

Browse files
[FSSDK-12169] rollup plugin typescript plugin removal
1 parent 7114de3 commit f97aef6

File tree

5 files changed

+17
-154
lines changed

5 files changed

+17
-154
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ lib
77
.npmrc
88
dist/
99
build/
10+
.build/
1011
.rpt2_cache
1112
.env
1213

package-lock.json

Lines changed: 2 additions & 130 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
"node": ">=18.0.0"
2828
},
2929
"scripts": {
30-
"clean": "rm -rf dist",
31-
"clean:win": "(if exist dist rd /s/q dist)",
30+
"clean": "rm -rf dist .build",
31+
"clean:win": "(if exist dist rd /s/q dist) && (if exist .build rd /s/q .build)",
3232
"prebuild": "npm run clean",
33-
"build": "tsc --noEmit && rollup -c",
34-
"build:win": "npm run clean:win && tsc --noEmit && rollup -c",
33+
"build": "tsc && rollup -c",
34+
"build:win": "npm run clean:win && tsc && rollup -c",
3535
"build-umd": "rollup -c --config-umd",
3636
"lint": "tsc --noEmit && eslint 'src/**/*.{js,ts,tsx}' --fix",
3737
"test": "jest --silent",
@@ -50,7 +50,8 @@
5050
},
5151
"dependencies": {
5252
"@optimizely/optimizely-sdk": "^5.4.1",
53-
"hoist-non-react-statics": "^3.3.2"
53+
"hoist-non-react-statics": "^3.3.2",
54+
"tslib": "^2.8.1"
5455
},
5556
"peerDependencies": {
5657
"react": ">=16.8.0"
@@ -81,7 +82,6 @@
8182
"react": "^18.3.0",
8283
"react-dom": "^18.3.0",
8384
"rollup": "^4.55.1",
84-
"rollup-plugin-typescript2": "^0.36.0",
8585
"ts-jest": "^29.2.3",
8686
"typescript": "^5.9.3"
8787
}

rollup.config.mjs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,15 @@ import commonjs from '@rollup/plugin-commonjs';
1818
import resolve from '@rollup/plugin-node-resolve';
1919
import replace from '@rollup/plugin-replace';
2020
import terser from '@rollup/plugin-terser';
21-
import typescript from 'rollup-plugin-typescript2';
2221
import pkg from './package.json' with { type: 'json' };
2322

2423
const { dependencies, peerDependencies } = pkg;
2524
const external = [...Object.keys(dependencies || {}), ...Object.keys(peerDependencies || {}), 'crypto'];
2625

27-
const typescriptPluginOptions = {
28-
exclude: ['./dist', '**/*.spec.ts', '**/*.spec.tsx'],
29-
include: ['./src/**/*.ts', './src/**/*.tsx'],
30-
};
31-
3226
const cjsBundle = (minify = true) => ({
33-
input: 'src/index.ts',
27+
input: '.build/index.js',
3428
external,
35-
plugins: [resolve({ browser: true }), commonjs(), typescript(typescriptPluginOptions), minify && terser()].filter(
36-
Boolean
37-
),
29+
plugins: [resolve({ browser: true }), commonjs(), minify && terser()].filter(Boolean),
3830
output: {
3931
file: `dist/react-sdk${minify ? '.min' : ''}.js`,
4032
format: 'cjs',
@@ -45,11 +37,9 @@ const cjsBundle = (minify = true) => ({
4537
});
4638

4739
const esmBundle = (minify = true) => ({
48-
input: 'src/index.ts',
40+
input: '.build/index.js',
4941
external,
50-
plugins: [resolve({ browser: true }), commonjs(), typescript(typescriptPluginOptions), minify && terser()].filter(
51-
Boolean
52-
),
42+
plugins: [resolve({ browser: true }), commonjs(), minify && terser()].filter(Boolean),
5343
output: {
5444
file: `dist/react-sdk.es${minify ? '.min' : ''}.js`,
5545
format: 'es',
@@ -58,7 +48,7 @@ const esmBundle = (minify = true) => ({
5848
});
5949

6050
const umdBundle = (minify = true) => ({
61-
input: 'src/index.ts',
51+
input: '.build/index.js',
6252
external: ['react'],
6353
plugins: [
6454
resolve({ browser: true }),
@@ -67,7 +57,6 @@ const umdBundle = (minify = true) => ({
6757
'process.env.NODE_ENV': JSON.stringify('production'),
6858
preventAssignment: true,
6959
}),
70-
typescript(typescriptPluginOptions),
7160
minify && terser(),
7261
].filter(Boolean),
7362
output: {

tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@
44
"module": "ESNext",
55
"lib": ["ES6", "DOM"],
66
"declaration": true,
7+
"importHelpers": true,
78
"strict": true,
89
"noImplicitThis": true,
910
"noImplicitReturns": true,
1011
"moduleResolution": "node",
1112
"esModuleInterop": true,
1213
"resolveJsonModule": true,
13-
"outDir": "./dist",
14+
"outDir": "./.build",
1415
"declarationDir": "./dist",
1516
"sourceMap": true,
1617
"skipLibCheck": true,
1718
"jsx": "react"
1819
},
1920
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
20-
"exclude": ["./dist", "./node_modules", "**/*.spec.ts", "**/*.spec.tsx"]
21+
"exclude": ["./dist", "./.build", "./node_modules", "**/*.spec.ts", "**/*.spec.tsx"]
2122
}

0 commit comments

Comments
 (0)