Skip to content

Webpack 5: ParserHelpers.addParsedVariableToModule is not a functionΒ #88

Open
@balloob

Description

@balloob

Using Webpack 5 beta 25 (latest as of today) and worker plugin 5.0.0.

Initially reported at #84 (comment) but realized should have opened an issue.

TypeError: ParserHelpers.addParsedVariableToModule is not a function
    at /home/paulus/dev/hass/frontend/node_modules/worker-plugin/dist/worker-plugin.js:120:25
    at Hook.eval [as call] (eval at create (/home/paulus/dev/hass/frontend/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:5:16)
    at JavascriptParser.callHooksForInfoWithFallback (/home/paulus/dev/hass/frontend/node_modules/webpack/lib/javascript/JavascriptParser.js:2784:24)
    at JavascriptParser.callHooksForExpression (/home/paulus/dev/hass/frontend/node_modules/webpack/lib/javascript/JavascriptParser.js:2666:16)
    at JavascriptParser.walkNewExpression (/home/paulus/dev/hass/frontend/node_modules/webpack/lib/javascript/JavascriptParser.js:2379:23)
    at JavascriptParser.walkExpression (/home/paulus/dev/hass/frontend/node_modules/webpack/lib/javascript/JavascriptParser.js:2131:10)
    at JavascriptParser.walkExpressions (/home/paulus/dev/hass/frontend/node_modules/webpack/lib/javascript/JavascriptParser.js:2078:10)
    at /home/paulus/dev/hass/frontend/node_modules/webpack/lib/dependencies/HarmonyImportDependencyParserPlugin.js:136:22
    at Hook.eval [as call] (eval at create (/home/paulus/dev/hass/frontend/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:5:16)
    at JavascriptParser.callHooksForInfoWithFallback (/home/paulus/dev/hass/frontend/node_modules/webpack/lib/javascript/JavascriptParser.js:2768:26)

Webpack 5 source for ParserHelpers does indeed not contain that function. Searching the Webpack 5 codebase also doesn't find it πŸ€”

I tried using the Webpack 4 definition on Webpack 5 does bundle, but doesn't work:

ReferenceError: __webpack__worker__0 is not defined

__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "renderMarkdown": () => /* binding */ renderMarkdown
/* harmony export */ });
/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! comlink */ "./node_modules/comlink/dist/esm/comlink.mjs");

let worker;
const renderMarkdown = async (content, markedOptions, hassOptions) => {
  if (!worker) {
    worker = (0,comlink__WEBPACK_IMPORTED_MODULE_0__.wrap)(new Worker(__webpack__worker__0, undefined));
  }

  return await worker.renderMarkdown(content, markedOptions, hassOptions);
};//# sourceURL=[module]

original source of above code (which works on webpack 4)

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