Skip to content
GitLab
    • Explore Projects Groups Snippets
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
  • !979

Proof of concept: Plugin System

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/dceddia/plugin-poc into master 8 years ago
  • Overview 3
  • Commits 1
  • Pipelines 0
  • Changes 3

Created by: dceddia

(This is related to issue #670 (closed))

This commit adds a "plugins" module and integrates it into the dev and prod build scripts.

The design and functionality is intentionally minimal, but it allows a user to write a plugin or series of plugins to manipulate the Webpack config as necessary. The example given in the plugins.js file shows a plugin that adds a SASS loader:

module.exports = function(webpackConfig) {
    webpackConfig.module.loaders.push({
      test: /\.scss$/,
      loaders: ["style", "css", "sass"]
    });
    return webpackConfig;
};

But conceivably any sort of Webpack config transformation could be done here.

Plugins are loaded and run, in order, from the plugins key in package.json. This would load a module named cra-plugin-sass, which would need to be npm install'd separately.

  "plugins": [
    "cra-plugin-sass"
  ]

We could also explore auto-discovery of plugins ala Babel or Karma, by searching for packages matching the "cra-plugin-*" prefix. However, the loading order does matter (since the config is transformed by every plugin in turn) and an array of plugins is more explicit.

Activity

  • Loading
  • Loading
  • Loading
Please register or sign in to reply
  1. 28 Oct, 2016 1 commit
    • Dave Ceddia's avatar
      Proof of concept: Plugin System · e70b8136
      Dave Ceddia authored 8 years ago
      This commit adds a "plugins" module and integrates it into the dev
      and prod build scripts.
      e70b8136
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
1
CLA Signed
1
CLA Signed
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 participant
Administrator
Reference: facebook/create-react-app!979
Source branch: github/fork/dceddia/plugin-poc

Menu

Explore Projects Groups Snippets