tsconfig-paths-webpack-plugin icon indicating copy to clipboard operation
tsconfig-paths-webpack-plugin copied to clipboard

Problem whith generated types declarations

Open euberdeveloper opened this issue 4 years ago • 0 comments

Hi, this is my webpack.config.js:

const path = require('path');
const nodeExternals = require('webpack-node-externals');
const DtsBundleWebpack = require('dts-bundle-webpack');
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');

module.exports = {
    target: 'node',
    mode: 'production',
    // devtool: 'source-map',
    entry: {
        index: './source/index.ts',
    },
    resolve: {
        extensions: ['.ts', '.js'],
        plugins: [new TsconfigPathsPlugin({
            configFile: './source/tsconfig.json',
            extensions: ['.ts', '.js']
        })]
    },
    module: {
        rules: [
            {
                test: /\.ts?$/,
                include: path.resolve(__dirname, 'source'),
                use: [
                    {
                        loader: 'ts-loader',
                    }
                ]
            }
        ]
    },
    plugins: [
        new DtsBundleWebpack({
            name: 'whdt-scraper',
            main: 'dist/index.d.ts',
            out: '../bundled/index.d.ts'
        })
    ],
    externals: [nodeExternals()],
    output: {
        path: path.resolve(__dirname, './bundled'),
        filename: 'index.js',
        library: 'whdt-scraper',
        libraryTarget: 'umd',
        globalObject: 'this',
        umdNamedDefine: true,
    }
}

The problem is that here, in the generated typings:

// Generated by dts-bundle v0.7.3
// Dependencies for this module:
//   ../@/types

declare module 'whdt-scraper' {
    import { Dump, Wiki, Version, DumpOptions, WikiOptions, VersionOptions } from '@/types';
    export * from '@/types';
    /**
        * Fetches the dumps of a wiki of the wikimedia history dump
        * @param version The version of the wiki (yyyy-mm or 'latest')
        * @param wiki The wiki whose dumps will be returned (e.g. 'itwiki')
        * @param options The options of the function
        * @returns The fetched dumps
        */
    export function fetchDumps(version: string, wiki: string, options?: DumpOptions): Promise<Dump[]>;
    /**
        * Fetches the wikies of a version of the wikimedia history dump
        * @param version The version of the wiki (yyyy-mm or 'latest')
        * @param options The options of the function
        * @returns The fetched wikies
        */
    export function fetchWikies(version: string, options?: WikiOptions): Promise<Wiki[]>;
    /**
        * Fetches the versions of the wikimedia history dump
        * @param options The options of the function
        * @returns The fetched versions
        */
    export function fetchVersions(options?: VersionOptions): Promise<Version[]>;
    /**
        * Fetches the latest version the wikimedia history dump
        * @param options The options of the function
        * @returns The latest version
        */
    export function fetchLatestVersion(options?: VersionOptions): Promise<Version | null>;
}

Only tha ones of the main file are included, the other are skipped with a // ../@/types.

euberdeveloper avatar Mar 20 '21 15:03 euberdeveloper