Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !5573

fix named-asset-import plugin to work with export-as syntax

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/NShahri/export-named-assets into master Oct 26, 2018
  • Overview 9
  • Commits 8
  • Pipelines 0
  • Changes 2

Created by: NShahri

The following code doesn't work

export {ReactComponent as LogoIcon} from './logo.svg';

case-2-error-message

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.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/NShahri/export-named-assets