Created by: NShahri
The following code doesn't work
export {ReactComponent as LogoIcon} from './logo.svg';
But it will work:
import {ReactComponent as LogoIcon} from './logo.svg';
export {LogoIcon};
Sample Project:
https://github.com/NShahri/create-react-app-export-named-assets
Result:
ORIGINAL: When there is no change in the project which is created by CRA https://github.com/NShahri/create-react-app-export-named-assets/blob/master/test-results/main.e0244443.chunk-original.js
CASE 1: Change to import {ReactComponent as LogoIcon} from './logo.svg'; {LogoIcon};
https://github.com/NShahri/create-react-app-export-named-assets/blob/master/test-results/main.35c51289.chunk-case-1.js
CASE 2: change to export {ReactComponent as LogoIcon} from './logo.svg';
https://github.com/NShahri/create-react-app-export-named-assets/blob/master/test-results/main.0cd4b7da.chunk-case-2.js#L32
CASE 2 with new named-assets-import plugin: https://github.com/NShahri/create-react-app-export-named-assets/blob/master/test-results/main.92516e27.chunk-case-2-new-named-assets-plugin.js
Note
CASE 1
and CASE 2 with new named-assets-import plugin
are identical.