-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
es2018 syntax in build.js for v2.7.x breaks webpack builds #12905
Comments
If you need to support older environments, you may want to look into https://github.com/mozilla/pdfjs-dist/tree/master/es5; please also note the pdfjs-dist README: https://github.com/mozilla/pdfjs-dist#pdfjs
What version of Webpack is that? |
Thanks for the prompt reply!
Thank you. It does appear to resolve my issue completely! In my case, I do need to support older browsers, so this works better than what I was attempting before anyway. And I don't need the hack described here either :) I only needed to change the import path.
It's Webpack 4.4, the latest that Angular with npm as the package manager will support (until v12, I think). I tried using yarn instead to use webpack 5, but I must have missed some step because everything broke. Regardless, my issue is resolved. The README had the necessary information. I just didn't read it before. |
@Snuffleupagus
The link is dead already. How can I run on the older webpack version? |
https://github.com/mozilla/pdfjs-dist#pdfjs still work just fine, and that README explicitly tells you what to do:
|
This should not be closed |
solution for those on old build systems here:
|
Configuration:
Steps to reproduce the problem:
What is the expected behavior? (add screenshot)
That there be a build file that is supported by the default JS loader in webpack.
What went wrong? (add screenshot)
The new syntax is not parse-able by Webpack's default JS loader and so throws an error suggesting a different loader.
The workaround for this is explained here, or you can include all of the
/node_modules
folder in your babel or Typescript (or whatever) loader.Neither of these workarounds work in the case of most Angular builds, however. No such control over loaders is available without "ejecting" the build configuration, meaning essentially that you now have to manage the webpack configuration yourself and manually apply complicated update steps whenever Angular itself bumps versions.
Custom Builders may hold a solution but I have yet to figure it out. The undefined
regeneratorRuntime
issue is stopping me despite recommendations here. And nothing is defined when I import from "pdfjs-dist" anymore.The text was updated successfully, but these errors were encountered: