Skip to content

Commit 529857d

Browse files
authored
Merge pull request #115 from podium-lib/dual-package-fix
Restructure dual module type package
2 parents e31b8e3 + e62f01f commit 529857d

File tree

4 files changed

+19
-36
lines changed

4 files changed

+19
-36
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ tmp/**/*
1313
.idea
1414
.idea/**/*
1515
coverage
16-
dist

dist/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "commonjs"
3+
}

package.json

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"name": "@podium/browser",
33
"version": "1.1.0",
44
"type": "module",
5-
"main": "./dist/cjs/src/index.js",
5+
"main": "./dist/index.js",
66
"exports": {
7-
"import": "./dist/esm/src/index.js",
8-
"require": "./dist/cjs/src/index.js"
7+
"require": "./dist/index.js",
8+
"import": "./src/index.js"
99
},
1010
"license": "MIT",
1111
"keywords": [
@@ -30,13 +30,11 @@
3030
],
3131
"types": "index.d.ts",
3232
"scripts": {
33-
"prepublishOnly": "npm run build:clean && npm run build",
34-
"build": "rollup --config",
35-
"build:clean": "rimraf dist",
33+
"prepublishOnly": "npm run build",
34+
"build": "rollup -c",
3635
"test": "tap test/*.js",
3736
"lint": "eslint . --ignore-pattern '/dist/'",
38-
"lint:fix": "eslint --fix . --ignore-pattern '/dist/'",
39-
"precommit": "lint-staged"
37+
"lint:fix": "eslint --fix . --ignore-pattern '/dist/'"
4038
},
4139
"dependencies": {
4240
"eventemitter3": "4.0.7"
@@ -52,20 +50,8 @@
5250
"eslint-config-prettier": "8.3.0",
5351
"eslint-plugin-import": "2.24.2",
5452
"eslint-plugin-prettier": "4.0.0",
55-
"lint-staged": "11.1.2",
5653
"prettier": "2.4.1",
57-
"rimraf": "3.0.2",
5854
"rollup": "2.57.0",
5955
"tap": "15.0.10"
60-
},
61-
"lint-staged": {
62-
"*.js": [
63-
"eslint --fix --config ./.eslintrc",
64-
"git add"
65-
],
66-
"{*.json,*.md,.eslintrc,.prettierrc}": [
67-
"prettier --write",
68-
"git add"
69-
]
7056
}
7157
}

rollup.config.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,17 @@ import { getBabelOutputPlugin } from '@rollup/plugin-babel';
22
import commonjs from '@rollup/plugin-commonjs';
33
import resolve from '@rollup/plugin-node-resolve';
44

5-
export default [{
5+
export default {
66
input: 'src/index.js',
7-
output: [{
8-
dir: 'dist/cjs',
9-
format: 'cjs',
10-
}],
117
plugins: [resolve(), commonjs(), getBabelOutputPlugin({
128
presets: ['@babel/preset-env']
139
})],
14-
preserveModules: true,
15-
},{
16-
input: 'src/index.js',
17-
output: [{
18-
dir: 'dist/esm',
19-
format: 'esm',
20-
}],
21-
plugins: [resolve(), commonjs()],
22-
preserveModules: true,
23-
}];
10+
output: [
11+
{
12+
exports: 'auto',
13+
format: 'cjs',
14+
dir: 'dist/',
15+
preserveModules: true,
16+
}
17+
],
18+
};

0 commit comments

Comments
 (0)