Webpack 5: ParserHelpers.addParsedVariableToModule is not a function
See original GitHub issueUsing Webpack 5 beta 25 (latest as of today) and worker plugin 5.0.0.
Initially reported at https://github.com/GoogleChromeLabs/worker-plugin/pull/84#issuecomment-657003936 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)
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
Webpack library function is not a function - Stack Overflow
As the title says, i'm getting an error in the browser Uncaught TypeError: MYLIB.init is not a function . webpack.config.js:.
Read more >worker-plugin - npm
Webpack plugin to bundle Workers automagically.. Latest version: 5.0.1, ... Compatibility Note: Webpack 5 now includes worker bundling.
Read more >Plugins - webpack
A webpack plugin is a JavaScript object that has an apply method. This apply method is called by the webpack compiler, giving access...
Read more >webpack @ 4.0.0-alpha.1 .. 4.0.0-alpha.2 - Package Diff
- parser.plugin("expression " + name,. - ParserHelpers.expressionIsUnsupported(name + " is not supported by webpack.") + parser.hooks.evaluateTypeof.for( ...
Read more >Calcite Components with Webpack 5 - Esri Community
I am trying to incorporate Calcite Components into a Webpack 5 app. ... [webpack-cli] TypeError: compiler.plugin is not a function at ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For people exploring the Webpack 5 syntax:
No extra plugin loading is required.
Same for typescript
https://github.com/azangru/web-worker-ts-webpack-test/blob/master/src/index.ts#L11