fix named-asset-import plugin to work with export-as syntax#5573
Merged
iansu merged 8 commits intofacebook:masterfrom Nov 20, 2018
Merged
fix named-asset-import plugin to work with export-as syntax#5573iansu merged 8 commits intofacebook:masterfrom
iansu merged 8 commits intofacebook:masterfrom
Conversation
Contributor
Author
Contributor
Author
|
Question: |
Contributor
Author
|
Also I added automation tests for this plugin in #5575. I will add tests for |
Contributor
|
Thanks for this. Let's get #5575 merged first and then we can tackle this. |
Contributor
|
Now that #5575 is merged can you please update this branch with master and expand the tests to include the export as syntax? |
iansu
reviewed
Oct 31, 2018
…port-named-assets
Contributor
Author
|
@iansu any luck to take a look at this. |
iansu
suggested changes
Nov 19, 2018
Contributor
|
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. |
Contributor
|
Thanks! |
dardub
added a commit
to OffBase/create-react-app
that referenced
this pull request
Nov 27, 2018
* upstream/master: (210 commits) Support setupTests.ts (facebook#5698) Remove unnecessary whitespace in template HTML Run prettier on HTML files (facebook#5839) Some Grammar fixes (facebook#5858) Fix link to page about running tests (facebook#5883) fix: make typescriptformatter support 0.5 of fork checker (facebook#5879) Always test with the latest stable Node version on Travis (facebook#5546) Fix propertyDecorator test Upgrade babel deps Fix annotated var test Fix TypeScript decorator support (facebook#5783) fix: add `sideEffects: false` to react-error-overlay (facebook#5451) Add allowESModules option to babel-preset-react-app (facebook#5487) Make named-asset-import plugin work with export-as syntax (facebook#5573) React native repository updated in README.md (facebook#5849) extra polyfills must be included manually (facebook#5814) Rename 'getting started' link to 'docs' (facebook#5806) docs: Simplify installing Storybook with npx (facebook#5788) Don't polyfill fetch for Node -- additional files (facebook#5789) docs: Change Storybook install documentation (facebook#5779) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.