unbuild icon indicating copy to clipboard operation
unbuild copied to clipboard

Improve log trace for `Potential missing package.json files` warning

Open gaogaoinvincible opened this issue 2 years ago • 8 comments

Environment

[email protected] React 18.2.0 unbuild 1.2.0

Reproduction

just run build

Describe the bug

When I run build, then give me this warnings

WARN Build is done with some warnings:

  • Potential missing package.json files: dist/index.cjs ERROR Exiting with code (1). You can change this behavior by setting failOnWarn: false .

Additional context

No response

Logs

No response

gaogaoinvincible avatar May 29 '23 08:05 gaogaoinvincible

How did you solve this?

BayBreezy avatar Oct 12 '23 02:10 BayBreezy

I would like to know as well @gaogaoinvincible , since I am running into the same thing

0x80 avatar Nov 27 '23 08:11 0x80

Hey @BayBreezy and @gaogaoinvincible !

The issue is solved by setting the rollup.emitCJS option as true

// build.config.ts
import { defineBuildConfig } from "unbuild";

export default defineBuildConfig({
    entries: ["./src/index"],
    outDir: "dist",
    declaration: true,
    rollup: {
        emitCJS: true
    }
});

henryhale avatar Jan 04 '24 12:01 henryhale

Oh, thanks @henryhale I just ended up ditching the package lol

BayBreezy avatar Jan 05 '24 18:01 BayBreezy

I also encountered this issue and only found out after checking that there is a non-existent file path in package. json.😀😀 image

RSS1102 avatar Aug 02 '24 05:08 RSS1102

(reopeniung, since altohugh this is not a bug with unbuild, we might make error tracing better)

pi0 avatar Aug 02 '24 08:08 pi0

^3.0.0

    import { defineBuildConfig } from "unbuild"

    export default defineBuildConfig({
            clean: true,
            entries: ["./src/index"],
            outDir: "dist",
            rollup: {
+                inlineDependencies: true,
           }
    })

Alicehhhmm avatar Dec 18 '24 08:12 Alicehhhmm

I'm still confused, there's no exactly way of solving this?

ThallesP avatar Aug 12 '25 16:08 ThallesP