Skip to content

Issue with outputChunk.fileName in plugin #2

Description

@james-camilleri

I can't seem to get this to work without modifying the plugin's use of outputChunk.fileName. This may be something peculiar with my setup, as I've tried to get this to work with the version of tsdown listed in the repo's package.json and still seem to be hitting this error.

The root of this seems to be this line:

const cssFiles: CSSFiles = chunkCssMap.get(outputChunk.fileName);

The outputChunk.fileName doesn't match the cached file name in the chunkCssMap. The outputChunk.preliminaryFileName, however, does. I'm not sure how the current reference to outputChunk.fileName works, but given it does with your setup I presume it must be related to my config, which I've attached below. I've hit the same error with single entry points and multiple entry points.

export default {
    entry: ['src/main/index.ts'],
    platform: 'browser',
    format: ['esm'],
    tsconfig: 'tsconfig.library.json',
    sourcemap: true,
    dts: true,
    loader: {
        '.jpg': 'asset',
        '.png': 'asset',
        '.svg': 'asset'
    },

    plugins: [
        lightningCss(),
        injectCssPlugin()
    ]

Not sure if this issue is helpful or not. I will clone the plugin (which works amazingly apart from this, thanks a ton) with these changes for now, but I'm happy to pop in a PR if you manage to reproduce.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions