Closed maslennikov closed 1 year ago
Right now I solved this with manual baseUrl
resolution in base config file shared across monorepo packages:
import fs from 'node:fs'
import path from 'node:path'
import json5 from 'json5'
// HACK https://github.com/SukkaW/rollup-plugin-swc/issues/41
const tsconfig = json5.parse(fs.readFileSync(TSCONFIG_PATH))
const baseUrl = path.resolve(tsconfig.compilerOptions.baseUrl)
export default {
// rest skipped
plugins: [
swc({
tsconfig: TSCONFIG_PATH,
jsc: {
baseUrl,
},
}),
],
}
Thanks for reporting this!
However, rollup-plugin-swc3 also supports extends
in the tsconfig.json
as well. So keeping the previous behavior might not be that easy.
@SukkaW I am using rollup-plugin-dts
to generate the declaration files. With this plugin, the above error is thrown.
plugin version: 0.10.2
Problem With the recent update(issues here and here), swc doesn't accept relative
baseUrl
anymore. When rollup plugin readstsconfig.json
, it passesbaseUrl
in whatever format is there, and normally, it is something like.
or./src
. It leads to errors:Suggested solution If tsconfig file found, resolve
baseUrl
as absolute path (value from itscompilerOptions.baseUrl
field resolved against absolute path of the given tsconfig file)