Skip to content

Commit f0ebe13

Browse files
committed
feat: reduce build result size
1 parent 2f505f1 commit f0ebe13

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

publish/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./dist/x-crawl.cjs.js')

publish/index.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import xCrawl from './index.js'
2+
3+
export default xCrawl

rollup.config.mjs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
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-
})
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+
// })
1616

17-
console.log(outputMap)
17+
// console.log(outputMap)
1818

1919
export default {
2020
input: 'src/index.ts',
21-
output: outputMap,
21+
output: {
22+
file: 'publish/dist/x-crawl.cjs.js',
23+
format: 'cjs',
24+
compact: true
25+
},
2226
treeshake: {
2327
tryCatchDeoptimization: false,
2428
unknownGlobalSideEffects: false

0 commit comments

Comments
 (0)