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
  • Issues
  • #4961
Closed
Open
Issue created Sep 04, 2018 by Administrator@rootContributor

Merge webpack alias configuration in one single file

Created by: Spyna

There are two webpack configuration files, one is for development and the other for production. Some parts of these files are duplicated, the alias configuration is one of them.

This duplicated alias configuration could be extracted to one external file and imported into the other two. In order to make its modification easier and faster.

webpack files involved:

  • development: packages/react-scripts/config/webpack.config.dev.js https://github.com/facebook/create-react-app/blob/next/packages/react-scripts/config/webpack.config.dev.js
  • production: packages/react-scripts/config/webpack.config.prod.js https://github.com/facebook/create-react-app/blob/next/packages/react-scripts/config/webpack.config.prod.js

The only downside I can see is when you need to use different aliases for the two environments, but:

  • this is a rare scenario
  • if you need this differentiation, you probably are an expert and know how to manage this.

I suggest

...
const aliases = require('./webpack.alias.config');
...
resolve: {
  ...
  alias: aliases
  ...
}
...
Assignee
Assign to
Time tracking