Skip to content
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

Doesn't work with webpack 5 (webpack/lib/ParserHelpers doesn't exist) #27

Closed
andreialecu opened this issue Nov 12, 2020 · 4 comments · Fixed by #33
Closed

Doesn't work with webpack 5 (webpack/lib/ParserHelpers doesn't exist) #27

andreialecu opened this issue Nov 12, 2020 · 4 comments · Fixed by #33
Labels
bug Something isn't working

Comments

@andreialecu
Copy link

It seems that a private API from webpack is being used here:

import ParserHelpers from 'webpack/lib/ParserHelpers';

This doesn't exist in Webpack 5 any more.

@andywer andywer added the bug Something isn't working label Nov 12, 2020
@andywer
Copy link
Owner

andywer commented Nov 12, 2020

Ahh, shit. Thanks for pointing out!

Time to pull updates from the plugin that this is based on. Need to find a bit of time for that as there will likely be a lot of merge conflicts…

@andreialecu
Copy link
Author

I'll actually be sending a small PR/diff with Webpack 5 support in a few minutes, as a quick band-aid. The file still exists but it was moved elsewhere.

@andreialecu
Copy link
Author

I opened #28 which inlines the ParserHelpers, and only imports something that exists in both 4 and 5.

I'm not able to run the test suite though. Let's continue discussion in #28.

@bbudd
Copy link

bbudd commented Dec 29, 2020

FWIW, it's been renamed to JavascriptParserHelper: https://webpack.js.org/blog/2020-10-10-webpack-5-release/

fixed code for this import is here:

let ParserHelpers;
try {
  ParserHelpers = require('webpack/lib/javascript/JavascriptParserHelpers'); // Webpack 5
} catch (e) {}
ParserHelpers = ParserHelpers || require('webpack/lib/ParserHelpers'); // Webpack 4

I'd put in a PR for just this fix, but there's a few updates beyond this which likely need doing as well. Going to poke around and see if I can get it running locally, if I have time I'll put a PR up

EDIT: PR is up, #33 - I made just the changes from the base repo which targeted webpack 5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants