Skip to content

Issue with Babel Loader #114

Description

@roger-fractal

Hey guys, hope you are doing welll!

So, wheeneveer I run the npm run start script, it proceeds to load my webpack.config.dev and it catches an issue on the render.js file from react-pdf-html:


./node_modules/react-pdf-html/dist/esm/render.js 26:22
Module parse failed: Unexpected token (26:22)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|   }
|   if (element.tag === 'a' || isText[element.tag]) {
>     if (element.style?.some(isBlockStyle)) {
|       return true;
|     }


This is the webpack.config section which seems to be loading that:

     // Process any JS outside of the app with Babel.
          // Unlike the application JS, we only compile the standard ES features.
          {
            test: /\.(js|mjs)$/,
            exclude: /@babel(?:\/|\\{1,2})runtime/,
            loader: require.resolve('babel-loader'),
            options: {
              babelrc: false,
              configFile: false,
              compact: false,
              presets: [
                [
                  require.resolve('babel-preset-react-app/dependencies'),
                  { helpers: true }
                ]
              ],
              cacheDirectory: true,
              // Don't waste time on Gzipping the cache
              cacheCompression: false,

              // If an error happens in a package, it's possible to be
              // because it was compiled. Thus, we don't want the browser
              // debugger to show the original code. Instead, the code
              // being evaluated would be much more helpful.
              sourceMaps: false
            }
          },

Does anybody has an idea of why it is not loading that file? I even checked the render.js file but could not find anything weird on that position (26:22).

Node version: v20.19.0
react-pdf-html version: 2.1.3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions