dominicbirch / bundle-declarations-webpack-plugin

Webpack wrapper around dts-bundle
MIT License
8 stars 1 forks source link

declare global ignored #20

Closed tini2n closed 9 months ago

tini2n commented 9 months ago

Hi! Trying to make ts library with d.ts bundle. The problem that my global typing ignoring by plugin. Have tried to import global.ts explicitly export * from './types/global' by index.ts entry file but still – just ignored this block:

declare global {
    namespace ... {
    ...
    }
}

config that I used for plugin:

config.plugins.push(new BundleDeclarationsWebpackPlugin({
    entry: ['src/index.ts', 'src/types/global.ts'],
    outFile: '@types/index.d.ts',
    compilationOptions: {
        preferredConfigPath: './tsconfig.json',
    },
    removeEmptyLines: false,
    removeEmptyExports: false,
    removeRelativeReExport: false,
}));

Any ideas here?

dominicbirch commented 9 months ago

From the dts-bundle-generator config docs:

           output: {
                /**
                 * Enables inlining of `declare global` statements contained in files which should be inlined (all local files and packages from inlined libraries).
                 * Optional. Default value is `false`.
                 */
                inlineDeclareGlobals: false,

^ might be worth giving this a try?