'ESBuild in NextJS: "You may need an appropriate loader to handle this file type" - /node_modules/esbuild/lib/main.d.ts
I am using mdx-bundler (which uses esbuild + node-gyp) in next.js. I have been working on this project for some time and everything is working. Now my partner just cloned the repo and tried to get it working but she gets:
../../node_modules/esbuild/lib/main.d.ts
Module parse failed: Unexpected token (1:7)
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
> export type Platform = 'browser' | 'node' | 'neutral';
| export type Format = 'iife' | 'cjs' | 'esm';
| export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'default';
I am not sure what this could be. I have all the loaders installed etc. and it is working fine on my machine. Is there something wrong with esbuild maybe?
We also checked the global npm packages installed on that other machine and have uninstalled and installed exactly the same versions that I have.
We also tried using different node versions via nvm
, and made sure she uses the exact same node version.
I don't know what else to do or what the problem could be here?
Here is a desription of a very similar error, that also has to do with mdx-bundler & esbuild
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|