Skip to content

Commit 29e878a

Browse files
committed
update rollup config & build process
1 parent b9ba19a commit 29e878a

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"umd": "dist/index.umd.js",
88
"types": "dist/index.d.ts",
99
"files": [
10-
"dist/**/*.js"
10+
"dist"
1111
],
1212
"sideEffects": false,
1313
"license": "MIT",
@@ -109,7 +109,7 @@
109109
},
110110
"scripts": {
111111
"clean-build": "npm-run-all clean build",
112-
"build": "tsc --outDir dist --declarationDir dist --declaration true && rollup -c",
112+
"build": "tsc --outDir dist --declarationDir dist --declaration true --emitDeclarationOnly true && rollup -c",
113113
"build-watch": "rollup -c -w",
114114
"clean": "rimraf dist",
115115
"typecheck": "tsc -p --noEmit",

rollup.config.mjs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
// For Node versions 17.5+ import assertion can be used
2-
// import pkg from './package.json' assert { type: 'json' };
3-
import { createRequire } from 'node:module';
4-
const require = createRequire(import.meta.url);
5-
const pkg = require('./package.json');
6-
71
import path from 'path';
82
import babel from '@rollup/plugin-babel';
93
import replace from '@rollup/plugin-replace';
104
import { terser } from 'rollup-plugin-terser';
115
import { DEFAULT_EXTENSIONS } from '@babel/core';
126
import typescript from '@rollup/plugin-typescript';
7+
import {createRequire} from 'node:module';
8+
9+
const require = createRequire(import.meta.url);
10+
const pkg = require('./package.json');
1311

1412
const globals = {
1513
'react': 'React',
@@ -27,8 +25,7 @@ const external = (id) => id.includes('@babel/runtime') || (!id.startsWith('.') &
2725
*/
2826
const replacePlugin = replace({
2927
preventAssignment: true,
30-
__ENVIRONMENT__: 'production',
31-
// 'process.env.NODE_ENV': JSON.stringify('production')
28+
'process.env.NODE_ENV': JSON.stringify('production'),
3229
});
3330

3431
// Remove data-testid attribute (since undefined in non-test environments)
@@ -106,8 +103,7 @@ export default [
106103
input,
107104
output: {
108105
file: pkg.module,
109-
format: 'es',
110-
// exports: 'named',
106+
format: 'esm',
111107
},
112108
plugins: commonPlugins(true),
113109
},

tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
{
22
"compilerOptions": {
33
"jsx": "react",
4-
"target": "ES2020",
4+
"target": "ES2018",
55
"module": "ESNext",
66
"moduleResolution": "node",
77
"strict": true,
8-
"allowJs": false,
98
"skipLibCheck": true,
109
"noUnusedLocals": true,
1110
"esModuleInterop": true,
1211
"isolatedModules": true,
13-
"resolveJsonModule": true,
1412
"noFallthroughCasesInSwitch": true,
1513
"forceConsistentCasingInFileNames": true
1614
},

0 commit comments

Comments
 (0)