Skip to content

Commit 3ee850b

Browse files
authored
Merge pull request #1 from eliot-akira/build-export-commonjs
feat: Build and export library in CommonJS format
2 parents 994e81b + 2b1f860 commit 3ee850b

File tree

4 files changed

+206
-9
lines changed

4 files changed

+206
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
/index.cjs

package-lock.json

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

package.json

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,31 @@
44
"description": "The path module from Node.js core for browsers",
55
"version": "1.1.0",
66
"scripts": {
7-
"test": "tape test/"
7+
"build": "rollup -c",
8+
"test": "node test"
9+
},
10+
"files": [
11+
"index.cjs",
12+
"index.d.ts",
13+
"index.js",
14+
"README.md"
15+
],
16+
"exports": {
17+
".": {
18+
"import": "./index.js",
19+
"require": "./index.cjs",
20+
"types": "./index.d.ts"
21+
}
822
},
923
"author": {
1024
"name": "James Halliday",
1125
"email": "[email protected]",
1226
"url": "http://substack.net"
1327
},
1428
"bugs": "https://github.com/isomorphic-git/path-browserify/issues",
15-
"dependencies": {},
1629
"devDependencies": {
30+
"@rollup/plugin-commonjs": "^28.0.2",
31+
"rollup": "^4.34.6",
1732
"tape": "^5.9.0"
1833
},
1934
"homepage": "https://github.com/isomorphic-git/path-browserify",
@@ -27,8 +42,5 @@
2742
"repository": {
2843
"type": "git",
2944
"url": "git://github.com/isomorphic-git/path-browserify.git"
30-
},
31-
"scripts": {
32-
"test": "node test"
3345
}
3446
}

rollup.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import commonjs from "@rollup/plugin-commonjs";
2+
3+
export default {
4+
input: "index.js",
5+
plugins: [
6+
commonjs(),
7+
],
8+
exports: 'named',
9+
output: [
10+
{
11+
file: "index.cjs",
12+
format: 'cjs',
13+
},
14+
],
15+
};

0 commit comments

Comments
 (0)