question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Describe the Bug

I’ve just had a go at upgrading to v11 from v10 - I’m seeing 3 build errors. Current react version is 17.0.2, which you’ve indicated should be compatible? I don’t think I should be having to add new loaders no?

✖ 「wdm」:
ERROR in /node_modules/@reactflow/core/dist/esm/index.js 16:19
Module parse failed: Unexpected token (16:19)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|
| function Attribution({ proOptions, position = 'bottom-right' }) {
>     if (proOptions?.hideAttribution) {
|         return null;
|     }

ERROR in /node_modules/@reactflow/minimap/dist/esm/index.js 36:31
Module parse failed: Unexpected token (36:31)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| function MiniMap({ style, className, nodeStrokeColor = '#555', nodeColor = '#fff', nodeClassName = '', nodeBorderRadius = 5, nodeStrokeWidth = 2, maskColor = 'rgb(240, 242, 243, 0.7)', position = 'bottom-right', }) {
|     const { boundingRect, viewBB, nodes, rfId } = useStore(selector, shallow);
>     const elementWidth = style?.width ?? defaultWidth;
|     const elementHeight = style?.height ?? defaultHeight;
|     const nodeColorFunc = getAttrFunction(nodeColor);

ERROR in /node_modules/@reactflow/controls/dist/esm/index.js 43:17
Module parse failed: Unexpected token (43:17)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     const onZoomInHandler = () => {
|         zoomIn();
>         onZoomIn?.();
|     };
|     const onZoomOutHandler = () => {
ℹ 「wdm」: Failed to compile.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

  1. Remove react-flow-renderer
  2. Add reactflow
  3. Change import package names
  4. Rebuild

Expected behavior

I expected my application to build as before

Screenshots or Videos

No response

Platform

  • OS: Linux
  • Browser: Chrome - n/a

Additional context

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Bartel-C8commented, Oct 5, 2022

For the ones using electron-webpack (using webpack 4, but obscuring config (which should make it easier, most of the time) some fixing code:

In your webpack.renderer.additions.js file:

const path = require("path")

module.exports = (config) => {
  config.module.rules.push({
    test: /\.(js|ts|tsx)$/,
    include: path.resolve(__dirname, "node_modules/@reactflow"),
    use: {
      loader: 'babel-loader',
      options: { presets: ['@babel/preset-env'] } // Presets used for env setup
    }
  });
}

The trick above is that all node_modules are excluded by default in the (inaccessible) config. But to explicitly include @reactflow here in the rule.

If you don’t have a webpack.renderer.additions.js yet, create it and enable it in your package.json:

...
  "electronWebpack": {
   "renderer": {
     "webpackConfig": "webpack.renderer.additions.js"
   }
  },
 ...

In general, also for @cgross : Maybe adding an include rule is easier? include: path.resolve(__dirname, "node_modules/@reactflow")

As the regex does not work that great apparently on Windows… Maybe you could try (untested): exclude: /node_modules(?![\/\\]@reactflow)/ instead of exclude: /node_modules(?!\/@reactflow)/ to match both backward and forward slashes (for Windows).

1reaction
cgrosscommented, Oct 7, 2022

Thanks @Bartel-C8. I was able to get around it by padding the necessary babel plugins to process reactflow rather than excluding it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build errors v11.0.0 · Issue #763 · qpdf/qpdf - GitHub
The MacPorts port maintainer here. I was trying to update qpdf to version 11.0.0 under macOS 12.5.1. I get the following build errors:....
Read more >
WINCC PRO V11 build problem with (0 errors, 0 warnings)
Hi all, as the title said, i have a problem with WINCC pro v11, i cant compile the software HMI, and it said...
Read more >
Xcode v11.1 and 11.2 - Build OK but Archive fails - GRPC
Running the project on a device in debug mode works, this error happens only when archiving. I guess this problems are due to...
Read more >
Jmol / Bugs / #608 fails to build from source jdk v13, v11, v10
#608 fails to build from source jdk v13, v11, v10. Milestone: v14. Status: open. Owner: nobody. Labels: None. Priority: 5.
Read more >
Solved: Problem incorporating V11.17.2 - Flexera Community
I am updating from V11.13.1.2 to V11.17.2 and have encountered a couple of issues getting lm_new.obj to build when in my code.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found