Webpack loader powered by swc
npm install @swc-node/loader@swc-node/loader> 🚀 Help me to become a full-time open-source developer by sponsoring me on Github
``js@swc-node/loader
{
test: /\.tsx?$/,
use: [
{
loader: '@swc-node/loader',
// If options not passed
// will read the project tsconfig.json as compile optionstsconfig.json
// If the default parse failed or not existedcompilerOptions
// The default options will be used
// is the same with compilerOptions in tsconfigcompilerOptions
options: {
// if provided, configFile will be ignored`
compilerOptions: {
target: 'ES5',
module: 'esnext',
sourceMap: true,
jsx: true,
},
// absolute path for tsconfig.json
configFile: path.join(process.cwd(), 'tsconfig.build.json'),
// enable react fast refresh
fastRefresh: true
}
}
],
exclude: /node_modules/,
}
This loader is compatible with tsconfig.json and compilerOptions in tsconfig.json`.