Hello all! I'm working with Pulumi at <fiveonefour...
# automation-api
b
Hello all! I'm working with Pulumi at fiveonefour.com. I'm trying to use the automation API in a NextJS application, but I'm getting the strangest error. The crazy thing is that I'm getting a .NET C# error on a Mac laptop. Does anyone know why this is?
Copy code
⨯ ./node_modules/node-gyp/lib/Find-VisualStudio.cs
Module parse failed: Unexpected token (9:6)
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>
| // This script needs to be compatible with PowerShell v2 to run on Windows 2008R2 and Windows 7.
|
> using System;
| using System.Text;
| using System.Runtime.InteropServices;

Import trace for requested module:
b
Not that I'm expert in such a setup (using C# from NodeJS) but it seems more to me that webpack tries to process the
*.cs
files in some way but it shouldn't I guess.
f
hm yeah looks more like a webpack thing. maybe this could help? https://github.com/webpack/webpack/discussions/13833
b
Well by a quick look I'd go with the last comment and check if npm is used as package manager and if so remove it from the project.
b
@big-architect-71258 @future-hairdresser-70637 Gents, the link above is one that my CTO and I also found. I always worry when I encounter an issue like this, that isn't well-documented online—it makes me think I'm doing something wrong. Thanks for the replies above!
f
i hear ya 🙂 were you able to get past the error then?
b
@future-hairdresser-70637, I was able to get past the issue using this config in my next.config.mjs file:
Copy code
/** @type {import('next').NextConfig} */
const nextConfig = {
  webpack: (config, { dev, isServer }) => {
    config.module.rules.push({
        test: /\.cs$/,
        use: 'ignore-loader'
    });

    return config;
  },  
};

export default nextConfig;
🎉 2
👍🏻 1
👍 1