Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Simplify configuration #18

Merged
merged 1 commit into from
Feb 14, 2017
Merged

Simplify configuration #18

merged 1 commit into from
Feb 14, 2017

Conversation

eliperelman
Copy link
Member

@eliperelman eliperelman commented Feb 14, 2017

  • No more need to return configuration
  • No more need for presets to merge configuration
  • No special API to extend a preset; simply call it with a Neutrino instance
  • No more need for presets to instantiate webpack-chain
  • No more dual configuration API when configuring and responding to events
  • Config from package.json no longer matches webpack config, but rather, maps to merge-able webpack-chain object
  • Switched from Uglify to Babili since babel-preset-env won't convert backticks to strings in web preset without breaking Uglify

Preset API

  • Configuration
module.exports = neutrino => {
  // modify Neutrino configuration instance
  neutrino.config...
}
  • Configuration with extending
const otherPreset = require('neutrino-preset-something');

module.exports = neutrino => {
  otherPreset(neutrino);

  // modify Neutrino configuration instance
  neutrino.config...
};
  • Configuration "schema" for package.json (will be converted into something usable by webpack-chain)

Note that while webpack-chain can take plugin from a config object, we can't do this from JSON, so it's not in Neutrino.

{
  "config": {
    "neutrino": {
      "target": "web",
      "output": {
        "publicPath": "./"
      },
      "node": {
        "console": false
      },
      "resolve": {
        "extensions": [".jsx"]
      },
      "resolveLoader": {
        "modules": ["./modules"]
      },
      "devServer": {
        "port": 4500
      },
      "entry": {
        "vendor": [
          "react"
        ]
      },
      "module": {
        "rule": {
          "compile": {
            "loader": {
              "babel": {
                "loader": "babel-loader",
                "options": {}
              }
            }
          }
        }
      }
    }
  }
}

@eliperelman eliperelman merged commit 7983923 into neutrinojs:master Feb 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant