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

Will swc-loader add appendTsSuffixTo option #63

Open
BppleMan opened this issue Aug 9, 2022 · 0 comments
Open

Will swc-loader add appendTsSuffixTo option #63

BppleMan opened this issue Aug 9, 2022 · 0 comments

Comments

@BppleMan
Copy link

BppleMan commented Aug 9, 2022

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant