Fitbit / webpack-config

Helps to load, extend and merge webpack configs
https://fitbit.github.io/webpack-config
Apache License 2.0
252 stars 18 forks source link

TypeError: Cannot read property 'extend' of undefined #101

Closed LeoIannacone closed 7 years ago

LeoIannacone commented 7 years ago

With version 7.3.0 does not work. Everything is ok with version 7.0.0

TypeError: Cannot read property 'extend' of undefined
    at Object.<anonymous> (/scripts/webpack/development.config.js:10:16)
    at Module._compile (module.js:570:32)
    at loader (/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at ConfigCache.get (/node_modules/webpack-config/src/ConfigCache.js:89:25)
mdreizin commented 7 years ago

@LeoIannacone I will take a look. Could you please share minimum example how to reproduce it?

mdreizin commented 7 years ago

@LeoIannacone Which node version do you use?

LeoIannacone commented 7 years ago

Sure:

this the config that raises the issue:

import path from 'path'
import Config from 'webpack-config'
import webpack from 'webpack'

import {PATHS} from '../../app.config'

const basePath = path.join(__dirname, 'base.config.js')
const base = require(basePath)

const config = Config().extend(basePath).merge({
  filename: __filename,
  devtool: 'cheap-module-eval-source-map',
  output: {
    pathinfo: true,
    devtoolModuleFilenameTemplate: 'webpack:///[absolute-resource-path]',
  },
  entry: {
    main: [
      `webpack-hot-middleware/client?path=${base.hotMiddleware.path}?reload=true`,
      PATHS.scripts.src,
    ],
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
  ],
})

export default config
node v6.10.1
npm 3.10.10
mdreizin commented 7 years ago

@LeoIannacone The root issue is from https://github.com/59naga/babel-plugin-add-module-exports. It looks like that this project is not supported any more and it doesn't parse properly multiple export statements.

I'm going to delete babel-plugin-add-module-exports and after that webpack-config should work as before.

mdreizin commented 7 years ago

@LeoIannacone For now you can use:

import {
  Config
} from 'webpack-config'
mdreizin commented 7 years ago

@LeoIannacone Did it help?

LeoIannacone commented 7 years ago

Yes, it fixes the issue. Thanks.

mdreizin commented 7 years ago

@LeoIannacone Great. I will close the issue.