prebundle 1.0.1 → 1.0.2
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/dist/prebundle.js +8 -11
- package/package.json +1 -1
package/dist/prebundle.js
CHANGED
|
@@ -25,16 +25,12 @@ function fixTypeExternalPath(file, task, externals) {
|
|
|
25
25
|
return newContent;
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
function emitDts(task) {
|
|
28
|
+
function emitDts(task, externals) {
|
|
29
29
|
if (task.ignoreDts) {
|
|
30
30
|
fs.writeFileSync(join(task.distPath, 'index.d.ts'), 'export = any;\n');
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
try {
|
|
34
|
-
const externals = {
|
|
35
|
-
...DEFAULT_EXTERNALS,
|
|
36
|
-
...task.externals,
|
|
37
|
-
};
|
|
38
34
|
const { files } = new DtsPacker({
|
|
39
35
|
cwd,
|
|
40
36
|
name: task.depName,
|
|
@@ -121,19 +117,20 @@ export async function prebundle(task, commonExternals) {
|
|
|
121
117
|
if (task.beforeBundle) {
|
|
122
118
|
await task.beforeBundle(task);
|
|
123
119
|
}
|
|
120
|
+
const mergedExternals = {
|
|
121
|
+
...DEFAULT_EXTERNALS,
|
|
122
|
+
...commonExternals,
|
|
123
|
+
...task.externals,
|
|
124
|
+
};
|
|
124
125
|
const { code, assets } = await ncc(task.depEntry, {
|
|
125
126
|
minify: task.minify,
|
|
126
127
|
target: 'es2019',
|
|
127
|
-
externals:
|
|
128
|
-
...DEFAULT_EXTERNALS,
|
|
129
|
-
...commonExternals,
|
|
130
|
-
...task.externals,
|
|
131
|
-
},
|
|
128
|
+
externals: mergedExternals,
|
|
132
129
|
assetBuilds: false,
|
|
133
130
|
});
|
|
134
131
|
emitIndex(code, task.distPath);
|
|
135
132
|
emitAssets(assets, task.distPath);
|
|
136
|
-
emitDts(task);
|
|
133
|
+
emitDts(task, mergedExternals);
|
|
137
134
|
emitLicense(task);
|
|
138
135
|
emitPackageJson(task);
|
|
139
136
|
removeSourceMap(task);
|