bunchee 2.1.6 → 2.2.0
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/cli.js +1 -1
- package/dist/lib.js +9 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
package/dist/lib.js
CHANGED
|
@@ -236,6 +236,7 @@ function buildInputConfig(entry, pkg, options, param) {
|
|
|
236
236
|
pkg.name
|
|
237
237
|
] : []));
|
|
238
238
|
var useTypescript = options.useTypescript, runtime = options.runtime, jscTarget = options.target, minify = options.minify;
|
|
239
|
+
var hasSpecifiedTsTarget = Boolean((tsCompilerOptions == null ? void 0 : tsCompilerOptions.target) && tsConfigPath);
|
|
239
240
|
var _obj;
|
|
240
241
|
var plugins = (dtsOnly ? [
|
|
241
242
|
shebang__default["default"](),
|
|
@@ -252,7 +253,7 @@ function buildInputConfig(entry, pkg, options, param) {
|
|
|
252
253
|
target: "esnext",
|
|
253
254
|
module: "esnext",
|
|
254
255
|
incremental: false,
|
|
255
|
-
jsx:
|
|
256
|
+
jsx: tsCompilerOptions.jsx || "react"
|
|
256
257
|
})
|
|
257
258
|
})
|
|
258
259
|
] : [
|
|
@@ -275,8 +276,9 @@ function buildInputConfig(entry, pkg, options, param) {
|
|
|
275
276
|
include: /\.(m|c)?[jt]sx?$/,
|
|
276
277
|
exclude: "node_modules",
|
|
277
278
|
tsconfig: tsConfigPath,
|
|
278
|
-
jsc: _extends$1({
|
|
279
|
-
target: jscTarget
|
|
279
|
+
jsc: _extends$1({}, !hasSpecifiedTsTarget && {
|
|
280
|
+
target: jscTarget
|
|
281
|
+
}, {
|
|
280
282
|
loose: true,
|
|
281
283
|
externalHelpers: false,
|
|
282
284
|
parser: (_obj = {
|
|
@@ -327,7 +329,8 @@ function buildOutputConfigs(options, pkg, param) {
|
|
|
327
329
|
// respect if tsconfig.json has `esModuleInterop` config;
|
|
328
330
|
// add ESModule mark if cjs and ESModule are both generated;
|
|
329
331
|
// TODO: support `import` in exportCondition
|
|
330
|
-
var
|
|
332
|
+
var mainExport = exportPaths["."];
|
|
333
|
+
var useEsModuleMark = Boolean(tsCompilerOptions.esModuleInterop || mainExport.main && mainExport.module);
|
|
331
334
|
var typings = getTypings(pkg);
|
|
332
335
|
var file = options.file && path.resolve(config.rootDir, options.file);
|
|
333
336
|
var dtsDir = typings ? path.dirname(path.resolve(config.rootDir, typings)) : path.resolve(config.rootDir, "dist");
|
|
@@ -366,8 +369,9 @@ function buildConfig(entry, pkg, cliArgs, dtsOnly) {
|
|
|
366
369
|
var ts = resolveTypescript(config.rootDir);
|
|
367
370
|
tsConfigPath = path.resolve(config.rootDir, "tsconfig.json");
|
|
368
371
|
if (fs__default["default"].existsSync(tsConfigPath)) {
|
|
372
|
+
var basePath = tsConfigPath ? path.dirname(tsConfigPath) : config.rootDir;
|
|
369
373
|
var tsconfigJSON = ts.readConfigFile(tsConfigPath, ts.sys.readFile).config;
|
|
370
|
-
tsCompilerOptions = ts.parseJsonConfigFileContent(tsconfigJSON, ts.sys,
|
|
374
|
+
tsCompilerOptions = ts.parseJsonConfigFileContent(tsconfigJSON, ts.sys, basePath).options;
|
|
371
375
|
} else {
|
|
372
376
|
tsConfigPath = undefined;
|
|
373
377
|
exit("tsconfig.json is missing in your project directory");
|