cereallarceny / cra-ssr

[DEPRECATED] Server-side rendering with create-react-app, React Router v4, Helmet, Redux, and Thunk
484 stars 118 forks source link

WebP file support #58

Open ostrichegret opened 5 years ago

ostrichegret commented 5 years ago

Fresh installed cra-ssr from git clone


import StoreFeature_1 from './feature_1.jpg';
import StoreFeature_1w from './feature_1.webp';

<picture>
          <source srcset={StoreFeature_1w} type="image/webp" />
          <source srcset={StoreFeature_1} type="image/jpeg" />
          <img src={StoreFeature_1} alt="Alt Text!" />
        </picture>

yarn start works fine

but yarn build and serve got error:


(node:33924) UnhandledPromiseRejectionWarning: D:\cra-ssr\src\app\routes\homepage\feature_1.webp:1
(function (exports, require, module, __filename, __dirname) { RIFF�
                                                                  ^

SyntaxError: Invalid or unexpected token
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)

    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Object.newLoader [as .js] (D:\REQCODE\React\cra-ssr\node_modules\pirates\lib\index.js:88:7)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
(node:33924) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by
rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:33924) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js proc
ess with a non-zero exit code.
Done in 10.56s.
cereallarceny commented 5 years ago

Hey, my apologies for the long wait @ostrichegret - I'm looking to ensure this is fixed with version 2.0. If you're interested, I could really use your thoughts for what you'd like to see in the upcoming version. Feel free to comment on the issue here with any suggestions. :)