Skip to content
This repository was archived by the owner on Jul 14, 2023. It is now read-only.

Will swc-loader add appendTsSuffixTo option #63

@BppleMan

Description

@BppleMan

Compiling ts with swc is blazingly fast, and its advantage over esbuild is that it supports decorate metadata, which is great.

I hope that swc-loader can support appendTsSuffixTo in the future, just like ts-loader appendTsSuffixTo, so that swc-loader can better support the compilation of .vue files

This is what I do now and it works fine so far. But I'm not sure if there are other problems with this。

// webpack.config.ts
// ...... other rules
{
    test: /\.ts$/i,
    exclude: ["/node_modules/"],
    use: [
        'swc-loader',
        resolve(__dirname, 'custom-loader')
    ],
},
// ...... other rules
// custom-loader.js
module.exports = function (content, sourceMap, meta) {
    if (sourceMap && this.resourcePath && this.resourcePath.endsWith(".vue")) {
        this.resourcePath += ".ts"
    }
    return content
}

This is what I do now and it works fine so far. But I'm not sure if there are other problems with this. If anyone can tell me how to add an option to swc-loader to do something similar, maybe I can submit a pull request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions