Uh oh!
There was an error while loading. Please reload this page.
fix named-asset-import plugin to work with export-as syntax - #5573
Conversation
NShahri
commented
Oct 26, 2018
NShahri
commented
Oct 26, 2018
Question: |
Also I added automation tests for this plugin in #5575. I will add tests for |
iansu
commented
Oct 31, 2018
Thanks for this. Let's get #5575 merged first and then we can tackle this. |
iansu
commented
Oct 31, 2018
Now that #5575 is merged can you please update this branch with master and expand the tests to include the export as syntax? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
NShahri
commented
Nov 8, 2018
@iansu any luck to take a look at this. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
iansu
commented
Nov 19, 2018
I finally had a chance to test this locally on the weekend and it works as expected. I requested a few small changes to the PR. Once those are done I think this is ready to go. |
iansu
commented
Nov 20, 2018
Thanks! |
* upstream/master: (210 commits) Support setupTests.ts (react#5698) Remove unnecessary whitespace in template HTML Run prettier on HTML files (react#5839) Some Grammar fixes (react#5858) Fix link to page about running tests (react#5883) fix: make typescriptformatter support 0.5 of fork checker (react#5879) Always test with the latest stable Node version on Travis (react#5546) Fix propertyDecorator test Upgrade babel deps Fix annotated var test Fix TypeScript decorator support (react#5783) fix: add `sideEffects: false` to react-error-overlay (react#5451) Add allowESModules option to babel-preset-react-app (react#5487) Make named-asset-import plugin work with export-as syntax (react#5573) React native repository updated in README.md (react#5849) extra polyfills must be included manually (react#5814) Rename 'getting started' link to 'docs' (react#5806) docs: Simplify installing Storybook with npx (react#5788) Don't polyfill fetch for Node -- additional files (react#5789) docs: Change Storybook install documentation (react#5779) ...
The following code doesn't work
But it will work:
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 1andCASE 2 with new named-assets-import pluginare identical.