webpack.config.js
function getBaseConfig(isProd) {

  // get library details from JSON config
  var libraryDesc = require('./package.json').library;
  var libraryEntryPoint = path.join('src', libraryDesc.entry);

  // generate webpack base config
  return {
    entry: path.join(__dirname, libraryEntryPoint),
    output: {
      // ommitted - will be filled according to target env
    },
    module: {
      preLoaders: [
        {test: /\.js$/, exclude: /(node_modules|bower_components)/, loader: "eslint-loader"}
      ],
      loaders: [
        {test: /\.js$/, exclude: /(node_modules|bower_components)/, loader: "babel-loader"},
      ]
    },
    eslint: {
        configFile: './.eslintrc'
    },
    resolve: {
      root: path.resolve('./src'),
      extensions: ['', '.js']
    },
    devtool: isProd ? null : '#eval-source-map',
    debug: !isProd,
    plugins: isProd ? [
      new webpack.DefinePlugin({'process.env': {'NODE_ENV': '"production"'}}),
      new UglifyJsPlugin({ minimize: true })
      // Prod plugins here
    ] : [
      new webpack.DefinePlugin({'process.env': {'NODE_ENV': '"development"'}})
      // Dev plugins here
    ]
  };
}
function getBaseConfig(isProd) {

  // get library details from JSON config
  var libraryDesc = require('./package.json').library;
  var libraryEntryPoint = path.join('src', libraryDesc.entry);

  // generate webpack base config
  return {
    entry: path.join(__dirname, libraryEntryPoint),
    output: {
      // ommitted - will be filled according to target env
    },
    module: {
      preLoaders: [
        {test: /\.js$/, exclude: /(node_modules|bower_components)/, loader: "eslint-loader"}
      ],
      loaders: [
        {test: /\.js$/, exclude: /(node_modules|bower_components)/, loader: "babel-loader"},
      ]
    },
    eslint: {
        configFile: './.eslintrc'
    },
    resolve: {
      root: path.resolve('./src'),
      extensions: ['', '.js']
    },
    devtool: isProd ? null : '#eval-source-map',
    debug: !isProd,
    plugins: isProd ? [
      new webpack.DefinePlugin({'process.env': {'NODE_ENV': '"production"'}}),
      new UglifyJsPlugin({ minimize: true })
      // Prod plugins here
    ] : [
      new webpack.DefinePlugin({'process.env': {'NODE_ENV': '"development"'}})
      // Dev plugins here
    ]
  };
}
function getBaseConfig ( isProd ) { // get library details from JSON config var libraryDesc = require ( './package.json' ) . library ; var libraryEntryPoint = path . join ( 'src' , libraryDesc . entry ) ; // generate webpack base config return { entry : path . join ( __dirname , libraryEntryPoint ) , output : { // ommitted - will be filled according to target env } , module : { preLoaders : [ { test : / \.js$ / , exclude : / (node_modules|bower_components) / , loader : "eslint-loader" } ] , loaders : [ { test : / \.js$ / , exclude : / (node_modules|bower_components) / , loader : "babel-loader" } , ] } , eslint : { configFile : './.eslintrc' } , resolve : { root : path . resolve ( './src' ) , extensions : [ '' , '.js' ] } , devtool : isProd ? null : '#eval-source-map' , debug : ! isProd , plugins : isProd ? [ new webpack . DefinePlugin ( { 'process.env' : { 'NODE_ENV' : '"production"' } } ) , new UglifyJsPlugin ( { minimize : true } ) // Prod plugins here ] : [ new webpack . DefinePlugin ( { 'process.env' : { 'NODE_ENV' : '"development"' } } ) // Dev plugins here ] } ; }
Build base config
@param  {Boolean} isProd [description]
@return {[type]}         [description]
Build base config