Skip to content
This repository was archived by the owner on May 29, 2022. It is now read-only.
This repository was archived by the owner on May 29, 2022. It is now read-only.

Easy-Webpack example not detecting generateConfig #47

@ed11s8c

Description

@ed11s8c

I am trying to learn easy-webpack and am following the easy-webpack/core walk through. In doing so I have attempted to implement the expanded example here. However I get an error

config = generateConfig(common, development, css);
         ^
TypeError: generateConfig is not a function

when I attempt to run webpack with

NODE_ENV=development node node_modules/webpack/bin/webpack.js

My webpack.js is

var path = require('path');
var DefinePlugin = require('webpack/lib/DefinePlugin');

var common = {
  entry: {
    'app': ['./ClientApp/boot']
  },
  output: {
    path: path.resolve('./wwwroot/dist'),
  }
};

var development = {
  devtool: 'cheap-module-inline-source-map',
  debug: true,
  output: {
    filename: '[name].bundle.js',
    sourceMapFilename: '[name].bundle.map',
    chunkFilename: '[id].chunk.js'
  },
  plugins: [
    new DefinePlugin({
      'process.env': {
        'NODE_ENV': JSON.stringify('development')
      }
    })
  ]
};

var production = {
  devtool: 'source-map',
  debug: false,

  output: {
    filename: '[name].[chunkhash].bundle.js',
    sourceMapFilename: '[name].[chunkhash].bundle.map',
    chunkFilename: '[id].[chunkhash].chunk.js'
  },

  plugins: [
    new DefinePlugin({
      'process.env': {
        'NODE_ENV': JSON.stringify('production')
      }
    })
  ]
};

var css = {
  module: {
    loaders: [{
      test: /\.css$/i,
      loaders: ['style', 'css']
    }]
  }
};

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

var config;

switch (process.env.NODE_ENV) {
  case 'development':
    config = generateConfig(common, development, css);
    break;
  case 'production':
    config = generateConfig(common, production, css);
    break;
}

module.exports = config;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions