easy-webpack / core

An easy way to create configuration files for Webpack
MIT License
68 stars 6 forks source link

Easy-Webpack unknown property in configuration object #48

Open ed11s8c opened 7 years ago

ed11s8c commented 7 years ago

I am trying to learn easy-webpack and so I have started with a minimum project aurelia project setup.

I get the following error when running webpack.

Run: node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js

Error:

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration has an unknown property 'metadata'. These properties are valid:
   object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
   For typos: please correct them.
   For loader options: webpack 2 no longer allows custom properties in configuration.
     Loaders should be updated to allow passing options via loader options in module.rules.
     Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
     plugins: [
       new webpack.LoaderOptionsPlugin({
         // test: /\.xxx$/, // may apply this only for some modules
         options: {
           metadata: ...
         }
       })
     ]

I do not see any reference to metadata in my webpack file and have no idea what is causing the error.

index.ts within easy-webpack has a reference to metadata but says its optional so I don't know why this is been thrown

These are my configuration files

package.json:

{
  "name": "AureliaSpa",
  "version": "0.0.0",
  "dependencies": {
    "aurelia-bootstrapper-webpack": "^1.1.0",
    "aurelia-event-aggregator": "^1.0.1",
    "aurelia-fetch-client": "^1.1.1",
    "aurelia-framework": "^1.1.0",
    "aurelia-history-browser": "^1.0.0",
    "aurelia-loader-webpack": "^2.1.0",
    "aurelia-logging-console": "^1.0.0",
    "aurelia-pal-browser": "^1.1.0",
    "aurelia-polyfills": "^1.2.0",
    "aurelia-route-recognizer": "^1.1.0",
    "aurelia-router": "^1.2.1",
    "aurelia-templating-binding": "^1.3.0",
    "aurelia-templating-resources": "^1.3.1",
    "aurelia-templating-router": "^1.1.0",
    "bootstrap": "^3.3.7",
    "isomorphic-fetch": "^2.2.1",
    "jquery": "^3.1.1"

  },
  "devDependencies": {
    "@types/node": "^6.0.45",
    "@easy-webpack/core": "2.0.1",
    "webpack": "2.2.0",
    "webpack-hot-middleware": "^2.10.0"
  },
  "aurelia": {
    "build": {
      "includeDependencies": "aurelia-*"
    }
  }
}

webpack.config.vendor.js:

var path = require('path');

var common = {
  entry: {
    vendor: [
        'aurelia-event-aggregator',
        'aurelia-fetch-client',
        'aurelia-framework',
        'aurelia-history-browser',
        'aurelia-logging-console',
        'aurelia-pal-browser',
        'aurelia-polyfills',
        'aurelia-route-recognizer',
        'aurelia-router',
        'aurelia-templating-binding',
        'aurelia-templating-resources',
        'aurelia-templating-router',
        'bootstrap',
        'bootstrap/dist/css/bootstrap.css',
        'jquery'
    ]
  },
  output: {
    path: path.join(__dirname, 'wwwroot', 'dist'),
    publicPath: '/dist/',
    filename: '[name].js',
    library: '[name]_[hash]'
  }
};

var generateConfig = require('@easy-webpack/core').generateConfig;

var config = generateConfig(common);

module.exports = config;
scottmmjackson commented 7 years ago

I found a workaround. Use the stripMetadata function from core.