Support Forums

Build error can't use createRequire module

ModuleParseError: Module parse failed: Unexpected token (5:36)
12:03:07 AM: File was processed with these loaders:
12:03:07 AM: * …/node_modules/babel-loader/lib/index.js
12:03:07 AM: You may need an additional loader to handle the result of these loaders.
12:03:07 AM: | import { createRequire } from ‘module’;
12:03:07 AM: |
12:03:07 AM: > const require = createRequire(import.meta.url);

Hi @HeatDaHpmepro,

Could you share the site name and a repo that reproduces this error?

1 Like

Ok so I’m stupid enough to ask and learn.
changed whole codebase to commonjs
it works now