Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--migrate :: TypeError: Cannot read property 'name' of undefined #76

Closed
arosenthal-r7 opened this issue Feb 27, 2017 · 1 comment
Closed

Comments

@arosenthal-r7
Copy link

arosenthal-r7 commented Feb 27, 2017

Do you want to request a feature or report a bug?

bug

What is the current behavior?

NODE_ENV=development webpack-cli --migrate ./webpack.config.js ./webpack.config.js
/Users/arosenthal/dev/webpack-cli/lib/transformations/loaderOptionsPlugin/loaderOptionsPlugin.js:22
		.filter(path => path.parent.value.key.name === 'plugins')
		                                     ^

TypeError: Cannot read property 'name' of undefined
    at ast.find.filter.path (/Users/arosenthal/dev/webpack-cli/lib/transformations/loaderOptionsPlugin/loaderOptionsPlugin.js:22:40)
    at Array.filter (native)
    at Collection.filter (/Users/arosenthal/dev/webpack-cli/node_modules/jscodeshift/dist/Collection.js:65:46)
    at module.exports (/Users/arosenthal/dev/webpack-cli/lib/transformations/loaderOptionsPlugin/loaderOptionsPlugin.js:22:4)
    at transforms.forEach.f (/Users/arosenthal/dev/webpack-cli/lib/transformations/index.js:40:26)
    at Array.forEach (native)
    at transform (/Users/arosenthal/dev/webpack-cli/lib/transformations/index.js:40:13)
    at module.exports (/Users/arosenthal/dev/webpack-cli/lib/migrate.js:9:23)
    at Object.<anonymous> (/Users/arosenthal/dev/webpack-cli/bin/webpack.js:171:30)
    at Module._compile (module.js:570:32)

If the current behavior is a bug, please provide the steps to reproduce.

^^^ do that with this config:

const path = require('path');
const webpack = require('webpack');

module.exports = {
  devtool: '#source-map',

  entry: './src/index.js',

  eslint: {
    configFile: '.eslintrc',
    emitError: true,
    failOnError: true,
    failOnWarning: true,
    formatter: require('eslint-friendly-formatter')
  },

  module: {
    preLoaders: [
      {
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'eslint?',

        test: /\.js$/
      }
    ],

    loaders: [
      {
        loader: 'json',
        test: /\.json$/
      }, {
        include: [
          path.resolve(__dirname, 'src')
        ],
        loader: 'babel',
        test: /\.js$/
      }
    ]
  },

  output: {
    filename: 'rapid7-visualization-color-schema.js',
    library: 'Rapid7VisualizationColorSchema',
    libraryTarget: 'umd',
    path: path.join(__dirname, 'dist'),
    umdNamedDefine: true
  },

  plugins: [
    new webpack.EnvironmentPlugin([
        'NODE_ENV'
    ])
  ],

  resolve: {
    extensions: [
      '',
      '.js'
    ],

    root: __dirname
  }
};

What is the expected behavior?
it transforms the config in to an wp2 compatible one.

Please mention other relevant information such as the browser version, Node.js version, Operating System and programming language.
node: v6.9.1
OS: OS X El Capitan 10.11.6

@TheLarkInn asked me to post this as an issue here. Let me know if you need any more info. Thanks!

@okonet
Copy link
Contributor

okonet commented Feb 28, 2017

Duplicate of #69

@okonet okonet closed this as completed Feb 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants