Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing gif in package - Error - Note that you need plugins to import files that are not JavaScript #489

Open
vinesh20 opened this issue Jul 29, 2022 · 0 comments

Comments

@vinesh20
Copy link

Thanks for this wonderful library to build npm package!

Is it possible to override default rollup configuration by adding rollup.config.js file?

We are importing a gif file inside the library. When we build after importing gif image in the library, got this error.

======================================================================================
Error: Unexpected character '' (Note that you need plugins to import files that are not JavaScript)
at /xbv/xmnvxnb/rollup.js
.
.
.
frame: '1: GIF89a\x00\x00�9\x00�����������������呑���������������摑���������揑���穫���������ͬ�������˪����������������̐�������������������ː����������̬���
����ˑ����������������ʬ����͑�����������\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00!�\x0BNETSCAPE2.0\x03\x01\x00\x00\x00!�\x0BXMP DataXMP <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 6.0-c002 79.164352, 2020/01/30-15:50:38 "> <rdf:RDF xmlns:rdf="ht
tp://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" xmp:CreatorTool="Adobe Photoshop 21.1 (Macintosh)" xmpMM:InstanceID="xmp.iid:3FAA0DFD6ED911EBA085C5E1DD90AE50" xmpMM:DocumentID="xmp.did:3FAA0DFE6ED911EBA085C5E1DD90AE50"> <xmpMM:DerivedFrom stRef:instanceID="xmp.iid:3FAA0DFB6ED911EBA085C5E1DD90AE50" stRef:documentID="xmp.did:3FAA0DFC6ED911EBA085C5E1DD90AE50"/> </rdf:Description> </rdf:RDF> </x:xmpmeta> \x01��������������������������������������������������������������������������������������������������������������������������������\x7F~}|{zyxwvutsrqponmlkjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! \x1F\x1E\x1D\x1C\x1B\x1A\x19\x18\x17\x16\x15\x14\x13\x12\x11\x10\x0F\x0E\r\f\x0B\n' +

======================================================================================

Details:

          using **@preconstruct/cli** version "^2.1.5",

importing gif as below in one of the component.

import defaultLoaderGif from '../../assets/images/default-loader.gif';

Options tried:

  1. created new rollup.config.js file and added new rollup plugin - @rollup/plugin-image
  2. new rollup.config.js file (followed step provided here - https://github.com/rollup/plugins/tree/master/packages/image)
import image from '@rollup/plugin-image';

export default {  
  plugins: [image()]
};

But still preconstruct build failing. Please help if you have faced similar issue before using gif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant