prebundle 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -44
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Prebundle
|
|
2
2
|
|
|
3
3
|
This package is used to prebundle 3rd party dependencies, based on [ncc](https://github.com/vercel/ncc) and `dts-packer`.
|
|
4
4
|
|
|
@@ -36,14 +36,17 @@ Supported dependency config:
|
|
|
36
36
|
Externals to leave as requires of the build.
|
|
37
37
|
|
|
38
38
|
```ts
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
// prebundle.config.mjs
|
|
40
|
+
export default {
|
|
41
|
+
dependencies: [
|
|
42
|
+
{
|
|
43
|
+
name: 'foo',
|
|
44
|
+
externals: {
|
|
45
|
+
webpack: '../webpack',
|
|
46
|
+
},
|
|
44
47
|
},
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
],
|
|
49
|
+
};
|
|
47
50
|
```
|
|
48
51
|
|
|
49
52
|
### minify
|
|
@@ -51,12 +54,15 @@ dependencies: [
|
|
|
51
54
|
Whether to minify the code, default `true`.
|
|
52
55
|
|
|
53
56
|
```ts
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
// prebundle.config.mjs
|
|
58
|
+
export default {
|
|
59
|
+
dependencies: [
|
|
60
|
+
{
|
|
61
|
+
name: 'foo',
|
|
62
|
+
minify: false,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
};
|
|
60
66
|
```
|
|
61
67
|
|
|
62
68
|
### packageJsonField
|
|
@@ -64,12 +70,15 @@ dependencies: [
|
|
|
64
70
|
Copy extra fields from original package.json to target package.json.
|
|
65
71
|
|
|
66
72
|
```ts
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
]
|
|
73
|
+
// prebundle.config.mjs
|
|
74
|
+
export default {
|
|
75
|
+
dependencies: [
|
|
76
|
+
{
|
|
77
|
+
name: 'foo',
|
|
78
|
+
packageJsonField: ['options'],
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
73
82
|
```
|
|
74
83
|
|
|
75
84
|
Following fields will be copied by default:
|
|
@@ -88,14 +97,17 @@ Following fields will be copied by default:
|
|
|
88
97
|
Callback before bundle.
|
|
89
98
|
|
|
90
99
|
```ts
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
100
|
+
// prebundle.config.mjs
|
|
101
|
+
export default {
|
|
102
|
+
dependencies: [
|
|
103
|
+
{
|
|
104
|
+
name: 'foo',
|
|
105
|
+
beforeBundle(task) {
|
|
106
|
+
console.log('do something');
|
|
107
|
+
},
|
|
96
108
|
},
|
|
97
|
-
|
|
98
|
-
|
|
109
|
+
],
|
|
110
|
+
};
|
|
99
111
|
```
|
|
100
112
|
|
|
101
113
|
### emitFiles
|
|
@@ -103,17 +115,20 @@ dependencies: [
|
|
|
103
115
|
Emit extra entry files to map imports.
|
|
104
116
|
|
|
105
117
|
```ts
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
]
|
|
118
|
+
// prebundle.config.mjs
|
|
119
|
+
export default {
|
|
120
|
+
dependencies: [
|
|
121
|
+
{
|
|
122
|
+
name: 'foo',
|
|
123
|
+
emitFiles: [
|
|
124
|
+
{
|
|
125
|
+
path: 'foo.js',
|
|
126
|
+
content: `module.exports = require('./').foo;`,
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
};
|
|
117
132
|
```
|
|
118
133
|
|
|
119
134
|
### ignoreDts
|
|
@@ -123,10 +138,13 @@ Ignore the original .d.ts declaration file, then generate a fake .d.ts file.
|
|
|
123
138
|
This can be used to reduce file size for the packages that do not require type definitions, such as webpack plugin.
|
|
124
139
|
|
|
125
140
|
```ts
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
141
|
+
// prebundle.config.mjs
|
|
142
|
+
export default {
|
|
143
|
+
dependencies: [
|
|
144
|
+
{
|
|
145
|
+
name: 'foo',
|
|
146
|
+
ignoreDts: true,
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
};
|
|
132
150
|
```
|
package/dist/index.d.ts
CHANGED