Wednesday, 7 June 2017

Webpack build issue when running gulp build

I had a previous issue that was related to trying to use webpack 2 before thinking it out further. That can be found here: webpack2 post . That said, going back into this and have now taken back to webpack 1.15.0, I run into another issue I am unsure of. When trying to run gulp build, I get this:

λ gulp build
[11:13:37] Loading C:\Vapor\source\mission-control\dashboard\gulp_tasks\browsersync.js
[11:13:37] Loading C:\Vapor\source\mission-control\dashboard\gulp_tasks\karma.js
[11:13:38] Loading C:\Vapor\source\mission-control\dashboard\gulp_tasks\misc.js
[11:13:38] Loading C:\Vapor\source\mission-control\dashboard\gulp_tasks\webpack.js
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
[11:13:39] Using gulpfile C:\Vapor\source\mission-control\dashboard\gulpfile.js
[11:13:39] Starting 'build'...
[11:13:39] Starting 'other'...
[11:13:39] Starting 'webpack:dist'...
[11:13:41] 'webpack:dist' errored after 1.47 s
[11:13:41] TypeError: Cannot read property 'replace' of undefined
    at Tapable.join (C:\Vapor\source\mission-control\dashboard\node_modules\enhanced-resolve\node_modules\memory-fs\lib\join.js:11:73)
    at Tapable.<anonymous> (C:\Vapor\source\mission-control\dashboard\node_modules\enhanced-resolve\lib\FileAppendPlugin.js:14:19)
    at Tapable.applyPluginsParallelBailResult (C:\Vapor\source\mission-control\dashboard\node_modules\tapable\lib\Tapable.js:139:14)
    at Tapable.<anonymous> (C:\Vapor\source\mission-control\dashboard\node_modules\enhanced-resolve\lib\Resolver.js:103:8)
    at Tapable.Resolver.forEachBail (C:\Vapor\source\mission-control\dashboard\node_modules\enhanced-resolve\lib\Resolver.js:196:3)
    at Tapable.doResolve (C:\Vapor\source\mission-control\dashboard\node_modules\enhanced-resolve\lib\Resolver.js:102:7)
    at Tapable.resolve (C:\Vapor\source\mission-control\dashboard\node_modules\enhanced-resolve\lib\Resolver.js:45:14)
    at Tapable.resolve (C:\Vapor\source\mission-control\dashboard\node_modules\enhanced-resolve\lib\UnsafeCachePlugin.js:23:14)
    at C:\Vapor\source\mission-control\dashboard\node_modules\webpack\lib\NormalModuleFactory.js:169:12
    at C:\Vapor\source\mission-control\dashboard\node_modules\async\lib\async.js:356:13
    at async.forEachOf.async.eachOf (C:\Vapor\source\mission-control\dashboard\node_modules\async\lib\async.js:233:13)
    at _asyncMap (C:\Vapor\source\mission-control\dashboard\node_modules\async\lib\async.js:355:9)
    at Object.map (C:\Vapor\source\mission-control\dashboard\node_modules\async\lib\async.js:337:20)
    at NormalModuleFactory.resolveRequestArray (C:\Vapor\source\mission-control\dashboard\node_modules\webpack\lib\NormalModuleFactory.js:166:8)
    at C:\Vapor\source\mission-control\dashboard\node_modules\async\lib\async.js:718:13
    at async.forEachOf.async.eachOf (C:\Vapor\source\mission-control\dashboard\node_modules\async\lib\async.js:233:13)
[11:13:41] 'build' errored after 1.47 s
[11:13:41] The following tasks did not complete: other
[11:13:41] Did you forget to signal async completion?

My webpack-dist.conf.js file looks like:

const webpack = require('webpack');
const conf = require('./gulp.conf');
const path = require('path');

const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');

module.exports = {
  module: {
    preLoaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loader: 'eslint'
      }
    ],

    loaders: [
      {
        test: /.json$/,
        loaders: [
          'json'
        ]
      },
      {
        test: /\.(css|scss)$/,
        loaders: ExtractTextPlugin.extract({
          fallbackLoader: 'style',
          loader: 'css?minimize!sass!postcss'
        })
      },
      {
        test: /.html$/,
        loaders: [
          'html'
        ]
      }
    ]
  },
  plugins: [
    new webpack.optimize.OccurrenceOrderPlugin(),
    new webpack.NoErrorsPlugin(),
    new HtmlWebpackPlugin({
      template: conf.path.src('index.html')
    }),
    new webpack.ContextReplacementPlugin(
      /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
      conf.paths.src
    ),
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': '"production"'
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress: {unused: true, dead_code: true, warnings: false} // eslint-disable-line camelcase
    }),
    new ExtractTextPlugin('index-[contenthash].css'),
    new webpack.optimize.CommonsChunkPlugin({name: 'vendor'})
  ],
  postcss: () => [autoprefixer],
  output: {
    path: path.join(process.cwd(), conf.paths.dist),
    filename: '[name]-[hash].js'
  },
  entry: `./${conf.path.src('index')}`
};

Any ideas of what is going on here and how to resolve?

Thanks much.



via Mark

No comments:

Post a Comment