In order to create a VTK class, macro.js module needs to be imported. When I import this module (
import macro from '@kitware/vtk.js/macro') in my application I get an error:
SyntaxError: Cannot use import statement outside a module. My application is based on react-scripts from create-react-app. If I copy an original file macro.js from @kitware/vtk.js to my local source folder I still get an error. Even if I remove all the contents of macro.js file I get an error:
The macro imported from "../macro" must be wrapped in "createMacro" which you can get from "babel-plugin-macros". Please refer to the documentation to see how to do this properly: https://github.com/kentcdodds/babel-plugin-macros/blob/master/other/docs/author.md#writing-a-macro. However, when I rename macro.js to macro2.js the error is gone.
Looks like CRA uses some special loader for macro.js files. Is there some way how can I disable this macro loader?