Skip to content

Commit 9f7ca08

Browse files
committed
feat: switch to esm
1 parent 6d8b494 commit 9f7ca08

File tree

6 files changed

+8
-20
lines changed

6 files changed

+8
-20
lines changed

jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
2-
module.exports = {
2+
3+
export default {
34
preset: 'ts-jest',
45
testEnvironment: 'node',
56
collectCoverage: true,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"multifunction"
1818
],
1919
"main": "packages/index.ts",
20+
"type": "module",
2021
"scripts": {
2122
"build": "rollup --config rollup.config.mjs",
2223
"build-dts": "tsc && prettier --write ./publish/src",

rollup.config.mjs renamed to rollup.config.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
11
import tsPlugin from 'rollup-plugin-typescript2'
22
import { getBabelOutputPlugin } from '@rollup/plugin-babel'
33

4-
// const outputMap = [
5-
// {
6-
// file: 'publish/dist/index.mjs',
7-
// format: 'es'
8-
// },
9-
// {
10-
// file: 'publish/dist/index.js',
11-
// format: 'cjs'
12-
// }
13-
// ].map((item) => {
14-
// return { ...item, compact: true }
15-
// })
16-
17-
// console.log(outputMap)
18-
194
export default {
205
input: 'packages/index.ts',
216
output: {
22-
file: 'publish/dist/x-crawl.cjs.js',
23-
format: 'cjs',
7+
file: 'publish/dist/x-crawl.js',
8+
format: 'es',
249
compact: true
2510
},
2611
treeshake: {

script/server.mjs renamed to script/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
input: 'test/server/index.ts',
77
output: {
88
file: 'test/server/index.js',
9-
format: 'cjs'
9+
format: 'es'
1010
},
1111
plugins: [tsPlugin(), terserPlugin(), runPlugin({ stdin: { clear: true } })]
1212
}

script/start.mjs renamed to script/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
input: 'test/start/index.ts',
77
output: {
88
file: 'test/start/index.js',
9-
format: 'cjs'
9+
format: 'es'
1010
},
1111
plugins: [tsPlugin(), terserPlugin(), runPlugin({ stdin: { clear: true } })]
1212
}

test/start/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.0.0",
44
"description": "",
55
"main": "index.js",
6+
"type": "module",
67
"scripts": {
78
"test": "echo \"Error: no test specified\" && exit 1"
89
},

0 commit comments

Comments
 (0)