mirror of
https://github.com/developit/microbundle.git
synced 2026-01-25 14:06:50 +00:00
feat(sourcemaps): support for ts sourcemaps and invert sourcemap flag (#227)
Closes #216.
This commit is contained in:
parent
41553421b0
commit
7fb4f08224
12
src/index.js
12
src/index.js
@ -86,6 +86,10 @@ export default async function microbundle(options) {
|
||||
options.name =
|
||||
options.name || options.pkg.amdName || safeVariableName(options.pkg.name);
|
||||
|
||||
if (options.sourcemap !== false) {
|
||||
options.sourcemap = true;
|
||||
}
|
||||
|
||||
const jsOrTs = async filename =>
|
||||
resolve(
|
||||
cwd,
|
||||
@ -345,7 +349,11 @@ function createConfig(options, entry, format, writeMeta) {
|
||||
typescript: require('typescript'),
|
||||
cacheRoot: `./.rts2_cache_${format}`,
|
||||
tsconfigDefaults: {
|
||||
compilerOptions: { declaration: true, jsx: options.jsx },
|
||||
compilerOptions: {
|
||||
sourceMap: options.sourcemap,
|
||||
declaration: true,
|
||||
jsx: options.jsx,
|
||||
},
|
||||
},
|
||||
}),
|
||||
!useTypescript && flow({ all: true, pretty: true }),
|
||||
@ -452,7 +460,7 @@ function createConfig(options, entry, format, writeMeta) {
|
||||
legacy: true,
|
||||
freeze: false,
|
||||
esModule: false,
|
||||
sourcemap: options.sourcemap !== false,
|
||||
sourcemap: options.sourcemap,
|
||||
treeshake: {
|
||||
propertyReadSideEffects: false,
|
||||
},
|
||||
|
||||
@ -27,6 +27,7 @@ export default handler => {
|
||||
.option('--name', 'Specify name exposed in UMD builds')
|
||||
.option('--cwd', 'Use an alternative working directory', '.')
|
||||
.option('--sourcemap', 'Generate source map', true)
|
||||
.example("microbundle --no-sourcemap # don't generate sourcemaps")
|
||||
.option('--raw', 'Show raw byte size', false)
|
||||
.option(
|
||||
'--jsx',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user