webdiscus / pug-plugin

Renders Pug template to HTML or template function. Resolves source files of scripts, styles, images in Pug . Uses Pug template as entry point.
https://webdiscus.github.io/pug-plugin/hello-world
ISC License
73 stars 8 forks source link

TypeScript emitted no output for /src/app/app.ts #62

Closed exocornet closed 1 year ago

exocornet commented 1 year ago

Hello,

using this pug-plugin package with TypeScript gives an error. I would like to understand how can TypeScript be used in the pug-plugin package?

new PugPlugin({
        pretty: true, // formatting HTML, useful for development mode
        verbose: true,
        js: {
            // output filename of extracted JS file from source script
            filename: 'js/[name].js',
        },
        css: {
            // output filename of extracted CSS file from source style
            filename: 'css/[name].css',
        },
    }),
            {
                test: /\.pug$/,
                oneOf: [
                    // import Pug in JavaScript/TypeScript as template function
                    {
                        issuer: /\.(js|ts)$/,
                        loader: PugPlugin.loader,
                        options: {
                            method: 'compile',
                            esModule: true,
                        },
                    },
                    // render Pug from Webpack entry into static HTML
                    {
                        loader: PugPlugin.loader,
                        options: {
                            method: 'compile',
                            data: {
                                listLinks: links,
                            },
                            embedFilters: {
                                escape: true,
                            },
                            // compileDebug: true,
                        },
                    },
                ],
            },

ERROR in ./src/app/app.ts Module build failed (from ./node_modules/ts-loader/index.js): Error: TypeScript emitted no output for /home/abstract13/Общедоступные/PhpstormProjects/AAtheBestPractics/src/app/app.ts. at makeSourceMapAndFinish (/home/abstract13/Общедоступные/PhpstormProjects/AAtheBestPractics/node_modules/ts-loader/dist/index.js:52:18) at successLoader (/home/abstract13/Общедоступные/PhpstormProjects/AAtheBestPractics/node_modules/ts-loader/dist/index.js:39:5) at Object.loader (/home/abstract13/Общедоступные/PhpstormProjects/AAtheBestPractics/node_modules/ts-loader/dist/index.js:22:5) @ ./src/pages/index/index.pug 4793:56-157

Thanks

webdiscus commented 1 year ago

Hello @exocornet, can you please create a small repo with reproducible issue.

webdiscus commented 1 year ago

@exocornet please create a repo with a reproducible issue and then reopen that issue.