Skip to content

Webpack 3 issue - ExternalModuleFactoryPlugin - 'request' of undefined #705

@mcrawshaw

Description

@mcrawshaw

Upgrading to webpack 3 generates an error when used with this plugin.

Degrading to webpack 2.x or removing the plugin from config resolves the error.

Note a simular issue here:
#596

Note webpack 3 compatibility issue & PR:
#699
#704

Plugin version:

yarn list v0.24.6
└─ html-webpack-plugin@2.28.0
✨  Done in 1.13s.

Webpack version:

yarn list v0.24.6
└─ webpack@3.0.0
✨  Done in 1.11s.

Summarised webpack.config (i've tried a blank plugin config - no change):

var webpack = require('webpack');
var path = require('path');
var htmlWebpackPlugin = require('html-webpack-plugin');
var faviconsWebpackPlugin = require('favicons-webpack-plugin');

const root = process.cwd();

module.exports = {
  resolve: {
    extensions: ['.tsx', '.ts', '.js', '.json']
  },
  plugins: [
    ...
    new htmlWebpackPlugin({
      title: 'HiveHub',
      description: 'A mapping platform for software systems',
      filename: 'index.html',
      template: path.join(root, 'src/index.ejs'),
      inject: false,
      appMountId: 'root',
      initialState: 'null',
      initialContent: 'null'
    })
  ],
  module: {
    rules: [
      ...
    ]
  }
};

Full stack dump:

ERROR in   TypeError: Cannot read property 'request' of undefined

  - ExternalModuleFactoryPlugin.js:37 handleExternals
    [metamap]/[html-webpack-plugin]/[webpack]/lib/ExternalModuleF    actoryPlugin.js:37:33

  - ExternalModuleFactoryPlugin.js:46 next
    [metamap]/[html-webpack-plugin]/[webpack]/lib/ExternalModuleF    actoryPlugin.js:46:8

  - ExternalModuleFactoryPlugin.js:59 handleExternals
    [metamap]/[html-webpack-plugin]/[webpack]/lib/ExternalModuleF    actoryPlugin.js:59:7

  - ExternalModuleFactoryPlugin.js:79 ExternalModuleFactoryPlugin    .<anonymous>
    [metamap]/[html-webpack-plugin]/[webpack]/lib/ExternalModuleF    actoryPlugin.js:79:5

  - NormalModuleFactory.js:246 applyPluginsAsyncWaterfall
    [metamap]/[webpack]/lib/NormalModuleFactory.js:246:4

  - Tapable.js:196 NormalModuleFactory.applyPluginsAsyncWaterfall    [metamap]/[webpack]/[tapable]/lib/Tapable.js:196:70

  - NormalModuleFactory.js:230 NormalModuleFactory.create
    [metamap]/[webpack]/lib/NormalModuleFactory.js:230:8

  - Compilation.js:383 Compilation._addModuleChain
    [metamap]/[webpack]/lib/Compilation.js:383:17

  - Compilation.js:465 Compilation.addEntry
    [metamap]/[webpack]/lib/Compilation.js:465:8

  - SingleEntryPlugin.js:22 SingleEntryPlugin.<anonymous>
    [metamap]/[html-webpack-plugin]/[webpack]/lib/SingleEntryPlug    in.js:22:15

  - Tapable.js:229 Compiler.applyPluginsParallel
    [metamap]/[webpack]/[tapable]/lib/Tapable.js:229:14

  - Compiler.js:505
    [metamap]/[webpack]/lib/Compiler.js:505:8

  - Tapable.js:131 Compiler.applyPluginsAsyncSeries
    [metamap]/[webpack]/[tapable]/lib/Tapable.js:131:46

  - Compiler.js:498 Compiler.compile
    [metamap]/[webpack]/lib/Compiler.js:498:7

  - Compiler.js:284 Compiler.runAsChild
    [metamap]/[webpack]/lib/Compiler.js:284:7

  - compiler.js:70
    [metamap]/[html-webpack-plugin]/lib/compiler.js:70:19

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions