diff --git a/core/docz-core/src/config/argv.ts b/core/docz-core/src/config/argv.ts index 111ad345b..f898f64e9 100644 --- a/core/docz-core/src/config/argv.ts +++ b/core/docz-core/src/config/argv.ts @@ -75,6 +75,7 @@ export interface Argv { native: boolean codeSandbox: boolean sourcemaps: boolean + notUseSpecifiers: boolean /* template args */ title: string description: string diff --git a/core/docz-core/src/config/babel.ts b/core/docz-core/src/config/babel.ts index b0675e191..28502d3f2 100644 --- a/core/docz-core/src/config/babel.ts +++ b/core/docz-core/src/config/babel.ts @@ -31,7 +31,12 @@ export const getBabelConfig = async ( ] const defaultPlugins = [ - require.resolve('babel-plugin-export-metadata'), + [ + require.resolve('babel-plugin-export-metadata'), + { + notUseSpecifiers: args.notUseSpecifiers, + }, + ], [ require.resolve('babel-plugin-named-asset-import'), { diff --git a/other-packages/babel-plugin-export-metadata/src/index.js b/other-packages/babel-plugin-export-metadata/src/index.js index 4951174b7..1d5c5f174 100644 --- a/other-packages/babel-plugin-export-metadata/src/index.js +++ b/other-packages/babel-plugin-export-metadata/src/index.js @@ -88,7 +88,7 @@ const insertNodeExport = t => (path, state) => { const declarationName = get(declaration, 'id.name') addFileMetaProperties(t, path, filename, declarationName) } - } else if (specifiers) { + } else if (specifiers && !state.opts.notUseSpecifiers) { for (specifier of specifiers) { const localName = get(specifier, 'local.name') const exportedName = get(specifier, 'exported.name')