Skip to content

Commit c8afc9f

Browse files
authored
Fix: Jest expects commonjs module by default(#98)
- Use commonjs module as default - Bundle into dist, removes the need of cp-css script To do - * Revert exports: 'named'
1 parent 958cdae commit c8afc9f

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

package.json

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
"name": "sendbird-uikit",
33
"version": "2.6.0",
44
"description": "React based UI kit for sendbird",
5-
"main": "release/index.js",
6-
"style": "release/dist/index.css",
7-
"typings": "release/index.d.ts",
8-
"module": "release/index.js",
5+
"main": "dist/cjs/index.js",
6+
"style": "dist/index.css",
7+
"typings": "dist/index.d.ts",
8+
"module": "dist/index.js",
99
"files": [
10-
"release/**/*",
1110
"dist/**/*",
1211
"package-lock.json",
1312
"LICENSE",
@@ -19,9 +18,8 @@
1918
"scripts": {
2019
"test": "jest",
2120
"test-update-snapshot": "jest -u",
22-
"cp-css": "./scripts/copy-css.sh",
23-
"clean-release": "rm -rf ./release; rm -rf ./dist",
24-
"build": "npm run clean-release; rollup -c; npm run cp-css",
21+
"clean-release": "rm -rf ./dist",
22+
"build": "npm run clean-release; rollup -c",
2523
"start": "rollup -c -w",
2624
"prepublishOnly": "npm run build",
2725
"predeploy": "cd example && npm install && npm run build",

rollup.config.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,16 @@ module.exports = ({
3535
},
3636
output: [
3737
{
38-
dir: 'release/dist/cjs',
38+
dir: 'dist/cjs',
3939
format: 'cjs',
4040
sourcemap: true,
41+
exports: 'named'
4142
},
4243
{
43-
dir: 'release',
44+
dir: 'dist',
4445
format: 'esm',
4546
sourcemap: true,
47+
exports: 'named'
4648
},
4749
],
4850
external: [
@@ -63,7 +65,7 @@ module.exports = ({
6365
autoprefixer,
6466
],
6567
sourceMap: true,
66-
extract: 'dist/index.css',
68+
extract: 'index.css',
6769
extensions: ['.sass', '.scss', '.css'],
6870
}),
6971
replace({
@@ -97,6 +99,7 @@ module.exports = ({
9799
},
98100
],
99101
],
102+
babelHelpers: 'bundled',
100103
extensions: ['.tsx', '.ts', '.jsx', '.js'],
101104
exclude: 'node_modules/**',
102105
plugins: [
@@ -114,7 +117,7 @@ module.exports = ({
114117
targets: [
115118
{
116119
src: './src/index.d.ts',
117-
dest: 'release',
120+
dest: 'dist',
118121
},
119122
],
120123
}),

scripts/copy-css.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)