Skip to content

TypeError: Cannot read property '0' of undefined #607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mikecfisher opened this issue Mar 3, 2017 · 10 comments
Closed

TypeError: Cannot read property '0' of undefined #607

mikecfisher opened this issue Mar 3, 2017 · 10 comments

Comments

@mikecfisher
Copy link

mikecfisher commented Mar 3, 2017

Hi all I'm having issues using this plugin in my webpack build.
I'm using Webpack 2.2.0 and html-webpack-plugin 2.28.0 and yarn 0.20.3

This is the full error

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

  - ExternalModuleFactoryPlugin.js:18 ExternalModuleFactoryPlugin.<anonymous>
    [phoenix-wallet]/[webpack]/lib/ExternalModuleFactoryPlugin.js:18:38

  - NormalModuleFactory.js:159
    [lib]/[webpack]/lib/NormalModuleFactory.js:159:3

  - Tapable.js:75 NormalModuleFactory.applyPluginsAsyncWaterfall
    [lib]/[webpack]/[tapable]/lib/Tapable.js:75:69

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

  - Compilation.js:356 Compilation.process [as _addModuleChain]
    [lib]/[webpack]/lib/Compilation.js:356:16

  - Compilation.js:424 Compilation.process [as addEntry]
    [lib]/[webpack]/lib/Compilation.js:424:7

  - SingleEntryPlugin.js:24 Compiler.compiler.plugin
    [phoenix-wallet]/[webpack]/lib/SingleEntryPlugin.js:24:16

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

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

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

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

  - debuggability.js:300 Promise._execute
    [phoenix-wallet]/[html-webpack-plugin]/[bluebird]/js/release/debuggability.js:300:9

  - promise.js:481 Promise._resolveFromExecutor
    [phoenix-wallet]/[html-webpack-plugin]/[bluebird]/js/release/promise.js:481:18

  - promise.js:77 new Promise
    [phoenix-wallet]/[html-webpack-plugin]/[bluebird]/js/release/promise.js:77:14

  - compiler.js:69 Object.compileTemplate
    [phoenix-wallet]/[html-webpack-plugin]/lib/compiler.js:69:10

  - index.js:47 Compiler.<anonymous>
    [phoenix-wallet]/[html-webpack-plugin]/index.js:47:40

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

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

  - Compiler.js:173 Compiler.<anonymous>
    [lib]/[webpack]/lib/Compiler.js:173:9

  - Compiler.js:302 Compiler.readRecords
    [lib]/[webpack]/lib/Compiler.js:302:10

  - Compiler.js:170 Compiler.<anonymous>
    [lib]/[webpack]/lib/Compiler.js:170:8

  - Tapable.js:67 Compiler.next
    [lib]/[webpack]/[tapable]/lib/Tapable.js:67:11

  - NodeEnvironmentPlugin.js:23 Compiler.<anonymous>
    [lib]/[webpack]/lib/node/NodeEnvironmentPlugin.js:23:3

  - Tapable.js:69 Compiler.next
    [lib]/[webpack]/[tapable]/lib/Tapable.js:69:14

  - CachePlugin.js:22 Compiler.<anonymous>
    [lib]/[webpack]/lib/CachePlugin.js:22:58

  - Tapable.js:71 Compiler.applyPluginsAsync
    [lib]/[webpack]/[tapable]/lib/Tapable.js:71:13

  - Compiler.js:167 Compiler.run
    [lib]/[webpack]/lib/Compiler.js:167:7

  - webpack.js:188 processOptions
    [lib]/[webpack]/bin/webpack.js:188:12

  - webpack.js:192 Object.<anonymous>
    [lib]/[webpack]/bin/webpack.js:192:1

And this is my webpack config as of now. Doesn't get much more basic than this

/* eslint complexity: ["off"] */
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
	entry: './index.js',
	output: {
		filename: 'bundle.js',
		path: path.resolve(__dirname, 'dist')
	},

	plugins: [
		new HtmlWebpackPlugin({}),
	]
};

The index.js file just contains a simple console.log() statement for now.
When I comment out HtmlWebpackPlugin({}) the build runs ok. Any idea whats happening?

@sebastiancarlsson
Copy link

sebastiancarlsson commented Mar 16, 2017

👍 I got this error too, similarly simple webpack config and also just a console.log in my entry file.

@sebastiancarlsson
Copy link

@mikefisher84 I was using Webpack 2.x and downgraded it to 1.13.2 (was using that version in an old project so I just tried with that version) and that fixed the problem

@sisodiaa
Copy link

Local installation of Webpack and Webpack-Dev-Server fixed this error for me.

@zp2359
Copy link

zp2359 commented Mar 23, 2017

@sebastiancarlsson I downgraded it to 1.7.0 and it worked.Thank you!

@joshkopecek
Copy link

Any movement on getting this fixed for use with webpack 2.x?

@mastilver
Copy link
Collaborator

I've been using this plugin alongside webpack 2.2.0-rc.2 and above, I never experience any issues

Can any of you give me a git repository that reproduce that issue?

@mastilver
Copy link
Collaborator

Closing this as I didn't hear from anyone

Feel free to reach out if it's still an issue

@milesrichardson
Copy link

milesrichardson commented May 25, 2017

Anyone else having this issue with create-react-app?

EDIT: Upgraded yarn to 0.24.5 and react-scripts to canary. Fixed. see facebook/create-react-app#2069

@gaearon
Copy link

gaearon commented May 26, 2017

Don't use canary please. Skip straight to latest 1.0.x release.

@lock
Copy link

lock bot commented May 31, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants