Open Plasticine-Yang opened 1 year ago
Same for me, have you resolved it?
Same for me, have you resolved it?
Not yet. No one responded to me, I could only cancel the alias.
Same for me, have you resolved it?
Not yet. No one responded to me, I could only cancel the alias.
I just add failOnWarn: false
in build.config.ts, because the packaged files are correct. It just a warning not an error.
+1 simple aliases like ~/ for src/ also trigger "Inlined implicit external", this with the fact that alias breaks in stub mode and mkdist means unbuild doesn't support alias at all.
It should not happen if aliases are configured to be bundled or externalized. Please provide a minimal reproduction (ie stackblitz/codesandbox).
Hello @pi0, heres a reproduction link:
https://codesandbox.io/p/github/NamesMT/starter-ts/draft/musing-albattani (run the reproduce script)
The warning is triggered using normal bundle mode and not mkdist, (but mkdist also breaks), alias is configured in both build.config.ts and tsconfig.json
Same for me, have you resolved it?
I just replace ungit with tsup.
I ran into the same issue… :/
Even for simple aliases but with the mkdist
builder it won't work. Let's say @lib
alias to lib
folder in case of mkdist
doesn't work and stays @lib/whatever
in the imports of the emitted files.
For anyone who is looking for a workaround, the only one I figured is to use vite in lib mode (config below). It's slower in case of the first run (13-15 seconds for my lib) (but very reliable as it uses tsc
to emit declarations) but subsequent if you use vite build --watch
is 8-9x faster. So just 2-3 seconds for my project.
// @ts-expect-error
import peerDepsExternal from 'rollup-plugin-peer-deps-external'
import type { LibraryFormats, UserConfig } from 'vite'
import dts from 'vite-plugin-dts'
import noBundle from 'vite-plugin-no-bundle'
import tsconfigPaths from 'vite-tsconfig-paths'
import react from '@vitejs/plugin-react-swc'
export default defineConfig({
{
plugins: [
tsconfigPaths(),
react(),
dts({ include: ['lib'], insertTypesEntry: true }),
noBundle({
root: './lib',
}),
],
build: {
minify: false,
sourcemap: true,
copyPublicDir: false,
reportCompressedSize: false,
lib: {
entry: {
index: resolve(__dirname, 'lib/index.ts')
},
formats: ["es"],
},
rollupOptions: {
plugins: [
peerDepsExternal({
includeDependencies: true,
}),
],
},
},
}
})
@sechi747
I just add failOnWarn: false in build.config.ts, because the packaged files are correct. It just a warning not an error.
Can you explain a little bit more? I am facing with this problem with https://github.com/nuxt/module-builder (which is built on top of unbuild), but there is no documents that show how/where to set failOnWarn: false
@trandaison
failOnWarn
is a configurable option of unbuild
. You can see its type definition here: https://github.com/unjs/unbuild/blob/main/src/types.ts#L87
But the nuxt/module-builder
indeed has fixed build options and cannot be freely configured. You can see its build method here: https://github.com/nuxt/module-builder/blob/main/src/commands/build.ts#L34
@sechi747 My current workaround solution:
// build.config.ts
import { defineBuildConfig } from "unbuild";
export default defineBuildConfig({
failOnWarn: false,
});
Hi @pi0, is this issue on the roadmap? These false positive warnings are very annoying to work with.
The same thing happens with package.json subpath imports https://nodejs.org/api/packages.html#subpath-imports
Here's a minimal reproduction https://stackblitz.com/edit/vitejs-vite-kwryzn?file=src%2Findex.ts
Lmk if I should open a new issue.
Indeed it's happening for my project as well. https://github.com/xsjcTony/remark-magic-link
This should definitely be fixed as it forces you to set failOnWarn: false
which is not safe.
There's seems to be the same issue before, and it's fixed https://github.com/unjs/unbuild/issues/383.
Checked the release note, maybe try v3.0.0-rc2
?
https://github.com/unjs/unbuild/releases/tag/v3.0.0-rc.2
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 topackages/browser/src/sdk.ts
, it is not a dependency package.So, it should be solved when I configure the alias
@
pointing topackages/browser/src
, but it still trigger theInlined 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
:The
@/sdk
points topackages/browser/src/sdk.ts
.build.config.ts
Logs
No response