unbuild
unbuild copied to clipboard
It's unreasonable to trigger `Inlined implicit external` warning when the related alias was configured.
Environment
Node.js version: v18.12.1
Reproduction
https://github.com/Plasticine-Yang/plasticine-monitor
run pnpm build:browser can trigger the bug.
Describe the bug
It will trigger Inlined implicit external @/sdk when I don't config the alias for @, which is reasonable.
However, the @/sdk is a path alias point to packages/browser/src/sdk.ts, it is not a dependency package.
I also configured the paths option in tsconfig.json, but it is just for IDE and tsc to resolve the path, which is not related to the rollup under the unbuild.
So, it should be solved when I configure the alias @ pointing to packages/browser/src, but it still trigger the Inlined implicit external @/sdk warning.
I'm not sure whether it is a bug or a feature. The issue can be closed if it is a feature.
Additional context
The file imports a module with alias: packages/browser/src/plugins/error-monitor-plugin/index.ts:
import type { Plugin } from '@plasticine-monitor/core'
import { WebSDK } from '@/sdk'
import { monitorJSError } from './monitors/js-error'
/**
* @description 监听运行时错误插件
*/
const errorMonitorPlugin = (): Plugin<WebSDK> => {
return {
install(webSDK) {
monitorJSError(webSDK)
},
}
}
const __TEMP__ = WebSDK
console.log(__TEMP__)
export { errorMonitorPlugin }
The @/sdk points to packages/browser/src/sdk.ts.
build.config.ts
export default defineBuildConfig({
entries: ['./src/index'],
outDir: 'dist',
clean: true,
declaration: true,
rollup: {
emitCJS: true,
},
alias: {
'@': resolve(__dirname, 'src'),
},
})

Logs
No response