pika-plugin-build-web-babel
Advanced tools
Comparing version 0.9.7 to 0.9.8
{ | ||
"name": "pika-plugin-build-web-babel", | ||
"description": "A @pika/pack plugin: Adds an babel compiled ESM distribution to your package", | ||
"version": "0.9.7", | ||
"version": "0.9.8", | ||
"files": [ | ||
@@ -6,0 +6,0 @@ "src/" |
@@ -52,2 +52,3 @@ var path = (require('path')); | ||
const babel = options.babel || {}; | ||
const preserveModules = options.preserveModules || false; | ||
const runtimeHelpers = options.runtimeHelpers || undefined; | ||
@@ -124,2 +125,4 @@ const src = path.join(cwd, 'src'); | ||
preserveModules, | ||
external: external || function (s) { | ||
@@ -152,5 +155,8 @@ const isLocal = (s.startsWith('/') || s.startsWith('./') || s.startsWith('../')); | ||
}); | ||
let output = {}; | ||
let output = { | ||
dir: path.dirname(writeToWeb), | ||
}; | ||
if (format === 'umd') { | ||
output = { | ||
...output, | ||
name: options.name, | ||
@@ -163,3 +169,3 @@ globals: options.globals || { | ||
} | ||
await result.write({ | ||
const config = { | ||
file: writeToWeb, | ||
@@ -170,3 +176,10 @@ format, | ||
sourcemap: options.sourcemap === undefined ? true : options.sourcemap | ||
}); | ||
}; | ||
if(preserveModules){ | ||
delete config.file; | ||
} else { | ||
delete config.output.dir; | ||
} | ||
await result.write(config); | ||
reporter.created(writeToWeb, 'module'); | ||
@@ -173,0 +186,0 @@ } |
20594
553