Skip to content

[@web/rollup-plugin-import-meta-assets] Add originalFileName to emitFile #3008

@dmnsgn

Description

@dmnsgn

Relevant Rollup documentation

Note that when emitting assets that correspond to an existing file, it is recommended to set the originalFileName property in the this.emitFile call instead as that will not only watch the file but also make the connection transparent to other plugins.
Link

Change required

Add:

 const ref = this.emitFile({ 
   type: 'asset', 
   name: assetName, 
+  originalFileName: absoluteAssetPath,
   source: transformedAssetContents, 
 }); 

to this call:

const ref = this.emitFile({
type: 'asset',
name: assetName,
source: transformedAssetContents,
});

Use case

Trying to map the source of some emitted assets in a plugin's writeBundle and getting null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions