mzgoddard / hard-source-webpack-plugin

https://www.npmjs.com/package/hard-source-webpack-plugin
ISC License
2.7k stars 160 forks source link

Cannot read property 'indexOf' of undefined #480

Open FengXianGuo opened 5 years ago

FengXianGuo commented 5 years ago

Cannot read property 'indexOf' of undefined

when i use hard-source run app more then twice times, i will get this error;

image

Actual Behavior

the first time run hard-source always work fine. image

the second time work all right, and get cache. image

but third time i will get the error! image

more detail:

TypeError: Cannot read property 'indexOf' of undefined
    at splitQuery (/Users/user/work/moviepro-h5/node_modules/_loader-runner@2.3.1@loader-runner/lib/LoaderRunner.js:19:14)
    at getContext (/Users/user/work/moviepro-h5/node_modules/_loader-runner@2.3.1@loader-runner/lib/LoaderRunner.js:238:17)
    at new NormalModule (/Users/user/work/moviepro-h5/node_modules/_webpack@2.7.0@webpack/lib/NormalModule.js:67:18)
    at Object.thaw (/Users/user/work/moviepro-h5/node_modules/_hard-source-webpack-plugin@0.13.1@hard-source-webpack-plugin/lib/util/serial.js:200:12)
    at Object.thaw (/Users/user/work/moviepro-h5/node_modules/_hard-source-webpack-plugin@0.13.1@hard-source-webpack-plugin/lib/util/serial.js:217:25)
    at Compiler.pluginCompat.tap (/Users/user/work/moviepro-h5/node_modules/_hard-source-webpack-plugin@0.13.1@hard-source-webpack-plugin/lib/TransformNormalModulePlugin.js:654:30)
    at Compiler.applyPluginsWaterfall (/Users/user/work/moviepro-h5/node_modules/_tapable@0.2.9@tapable/lib/Tapable.js:92:24)
    at Object.exports.call (/Users/user/work/moviepro-h5/node_modules/_hard-source-webpack-plugin@0.13.1@hard-source-webpack-plugin/lib/util/plugin-compat.js:175:38)
    at thaw (/Users/user/work/moviepro-h5/node_modules/_hard-source-webpack-plugin@0.13.1@hard-source-webpack-plugin/lib/SystemArchetype.js:126:29)
    at fetch (/Users/user/work/moviepro-h5/node_modules/_hard-source-webpack-plugin@0.13.1@hard-source-webpack-plugin/lib/SystemArchetype.js:173:16)

debug info: image

image

Operating System, Node, and NPM dependency versions

Mac OS 
Node 8.9.4

"devDependencies": {
        "@ali/image-loader": "^1.1.0",
        "@ali/retcodelog": "^0.2.15",
        "@antv/data-set": "^0.8.9",
        "@types/jest": "^23.1.4",
        "babel-core": "^6.24.1",
        "babel-eslint": "^10.0.1",
        "babel-jest": "^23.6.0",
        "babel-loader": "^6.4.1",
        "babel-plugin-import": "^1.11.0",
        "babel-plugin-transform-runtime": "^6.23.0",
        "babel-preset-es2015": "^6.24.1",
        "babel-preset-stage-2": "^6.24.1",
        "babel-runtime": "^6.23.0",
        "chalk": "^1.1.3",
        "clean-webpack-plugin": "~0.1.16",
        "css-loader": "^0.14.5",
        "cssmin": "^0.4.3",
        "cssnano": "^3.10.0",
        "eslint": "^3.7.1",
        "eslint-config-standard": "^5.1.0",
        "eslint-config-vue": "^1.1.0",
        "eslint-friendly-formatter": "^4.0.1",
        "eslint-loader": "^2.1.1",
        "eslint-plugin-html": "^1.5.3",
        "eslint-plugin-promise": "^1.0.8",
        "eslint-plugin-standard": "^1.3.2",
        "eslint-plugin-vuefix": "^0.2.1",
        "extract-text-webpack-plugin": "^2.1.2",
        "file-loader": "~0.8.5",
        "friendly-errors-webpack-plugin": "1.7.0",
        "fs-extra": "^2.1.2",
        "glob": "^7.0.6",
        "happypack": "^5.0.0",
        "hard-source-webpack-plugin": "~0.13.1",
        "html-minifier": "^3.5.3",
        "html-webpack-plugin": "^2.30.1",
        "jasmine-core": "^2.99.1",
        "js-yaml": "^3.9.1",
        "json-loader": "~0.5.4",
        "less": "^2.7.2",
        "less-loader": "^2.2.3",
        "lodash": "^4.17.4",
        "optimize-css-assets-webpack-plugin": "^1.3.0",
        "parse5": "^3.0.2",
        "postcss-cssnext": "^3.1.0",
        "postcss-loader": "^2.0.10",
        "strip-json-comments": "^2.0.1",
        "style-loader": "^0.13.2",
        "uglifyjs-webpack-plugin": "^1.1.1",
        "url-loader": "~0.5.8",
        "vue-lazyload": "^1.2.6",
        "vue-loader": "^11.0.0",
        "vue-style-loader": "^1.0.0",
        "vue-template-compiler": "~2.5.13",
        "webpack": "^2.5.1",
        "webpack-bundle-analyzer": "^2.9.1",
        "webpack-dev-server": "2.7.1",
        "webpack-merge": "^4.1.4",
        "webpack2-polyfill-plugin": "^0.0.2"
    },
strokirk commented 5 years ago

This affects us a lot too, after upgrading from version 0.5.18 to 0.13.1.

ahjsrhj commented 5 years ago

same problem, the plugin version is last 0.13.1

mattgrande commented 5 years ago

Just started getting this. Should I downgrade to an older version? Have you guys figured out a way around it?

trkaplan commented 5 years ago

I am randomly getting this error on gitlab CI builds. Does anyone have a workaround? Ihave a parameter to clean cache folder in case of any error but I am looking for a permanent solution.

[hardsource:e3cd29b8] Using 132 MB of disk space.
[hardsource:e3cd29b8] Tracking node dependencies with: package-lock.json.
[hardsource:e3cd29b8] Reading from cache e3cd29b8...
(node:30186) **UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'indexOf' of undefined**
    at splitQuery (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/loader-runner/lib/LoaderRunner.js:19:14)
    at getContext (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/loader-runner/lib/LoaderRunner.js:238:17)
    at new NormalModule (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/webpack/lib/NormalModule.js:69:18)
    at Object.thaw (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/hard-source-webpack-plugin/lib/util/serial.js:199:12)
    at Object.thaw (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/hard-source-webpack-plugin/lib/util/serial.js:216:25)
    at Compiler.pluginCompat.tap (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/hard-source-webpack-plugin/lib/TransformNormalModulePlugin.js:654:30)
    at Compiler.applyPluginsWaterfall (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/tapable/lib/Tapable.js:92:24)
    at Object.exports.call (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/hard-source-webpack-plugin/lib/util/plugin-compat.js:175:38)
    at thaw (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/hard-source-webpack-plugin/lib/SystemArchetype.js:126:29)
    at fetch (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/hard-source-webpack-plugin/lib/SystemArchetype.js:173:16)
    at NormalModuleFactory.normalModuleFactoryHooks.createModule.tap (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/hard-source-webpack-plugin/lib/TransformNormalModuleFactoryPlugin.js:213:28)
    at NormalModuleFactory.applyPluginsBailResult (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/tapable/lib/Tapable.js:129:27)
    at applyPluginsAsyncWaterfall (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/webpack/lib/NormalModuleFactory.js:75:31)
    at /home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/tapable/lib/Tapable.js:268:11
    at NormalModuleFactory.params.normalModuleFactory.plugin (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/webpack/lib/CompatibilityPlugin.js:52:5)
    at NormalModuleFactory.applyPluginsAsyncWaterfall (/home/gitlab-runner/builds/81c81de8/1/myApp/react-app/node_modules/tapable/lib/Tapable.js:272:13)
(node:30186) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:30186) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
freekode commented 5 years ago

Yeah, have the same error. Version 0.13.1.

mokkabonna commented 5 years ago

Got this after working fine for a while. Not I get it every time. Deleting the cache fixed it. For a while only..

freekode commented 5 years ago

Last commit more than year ago, is this project still alive? Is there any alternatives for this plugin?

leohxj commented 5 years ago

I have the same error on v0.13.1.

DStar2013 commented 4 years ago

got the same error on v0.13.1. @mzgoddard

will downgrade solve this?

brainz80 commented 4 years ago

updating @popperjs/core fixed the issue for us. We used to have version 2.1.0. I updated it to 2.4.4 and Cannot read property 'indexOf' of undefined error went away.

54853315 commented 1 year ago

2022年还停留在0.13.1版本,且同样有这个问题。 webpack: ^3.0.0