Skip to content

Commit 01d67e2

Browse files
Remove commonjs.
1 parent 9f7969e commit 01d67e2

File tree

3 files changed

+17
-88
lines changed

3 files changed

+17
-88
lines changed

package-lock.json

-43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
"name": "react-tweeker-js",
33
"version": "1.4.0",
44
"description": "A react wrapper for the tweeker embed script",
5-
"main": "dist/index.cjs.js",
6-
"module": "dist/index.esm.js",
5+
"main": "dist/index.js",
76
"files": [
87
"dist"
98
],
@@ -24,7 +23,6 @@
2423
"@babel/core": "^7.9.0",
2524
"@babel/preset-env": "^7.9.0",
2625
"@babel/preset-react": "^7.9.0",
27-
"@rollup/plugin-commonjs": "^11.0.2",
2826
"@rollup/plugin-node-resolve": "^7.1.1",
2927
"react": "^16.13.1",
3028
"react-dom": "^16.13.1",

rollup.config.js

+16-42
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,24 @@
11
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
22
import babel from 'rollup-plugin-babel'
33
import resolve from '@rollup/plugin-node-resolve'
4-
import commonjs from '@rollup/plugin-commonjs'
54
import pkg from './package.json'
65

7-
const INPUT_FILE_PATH = 'src/index.js';
8-
const OUTPUT_NAME = 'ReactTweekerJs';
9-
10-
const PLUGINS = [
11-
peerDepsExternal(),
12-
resolve(),
13-
commonjs({
14-
namedExports: {
15-
'tweeker-js': ['embedTweeker']
16-
}
17-
}),
18-
babel({
19-
exclude: 'node_modules/**',
20-
}),
21-
]
22-
23-
const GLOBALS = {
24-
react: 'React',
25-
'react-dom': 'ReactDOM',
26-
}
27-
28-
const OUTPUT_DATA = [
29-
{
6+
export default {
7+
input: 'src/index.js',
8+
output: {
309
file: pkg.main,
31-
format: 'cjs',
32-
},
33-
{
34-
file: pkg.module,
3510
format: 'es',
11+
name: 'ReactTweekerJs',
12+
globals: {
13+
react: 'React',
14+
'react-dom': 'ReactDOM',
15+
},
3616
},
37-
]
38-
39-
const config = OUTPUT_DATA.map(({ file, format }) => ({
40-
input: INPUT_FILE_PATH,
41-
output: {
42-
file,
43-
format,
44-
name: OUTPUT_NAME,
45-
globals: GLOBALS,
46-
},
47-
plugins: PLUGINS,
48-
}))
49-
50-
export default config
17+
plugins: [
18+
peerDepsExternal(),
19+
resolve(),
20+
babel({
21+
exclude: 'node_modules/**',
22+
}),
23+
],
24+
}

0 commit comments

Comments
 (0)