I use a custom webpack config as detailed in the Next.js docs Custom Webpack Config page. PhpStorm has built-in support for handling webpack, however, since there is no actual webpack config file to point to, how does one integrate their IDE with a custom Next.js webpack config?
One issue I'm running into is PhpStorm complaining (rightfully) that the SVG I'm trying to import is not a module. However, this works because I'm using the @svgr/webpack
loader. I'm assuming if I can get PhpStorm to "see" my webpack config, it won't complain about such things.
Having a command to generate a webpack config from next.config.js
, for example, might be a viable workaround. Another is having a reference to a file that is dynamically resolved to the same config that the Next.js config file would use; this is the approach taken by Vue.
As I'm using TypeScript, I have a tsconfig.json
file at the root of my project, which serves to provide appropriate path aliasing and code/path completion.
The issue I'm running into is this:
The file someSvg.svg
exists at the specified location, and the code runs as expected. However, PhpStorm is complaining. Is it possible to make PhpStorm aware of the fact that this import is being handled by webpack, specifically the @svgr/webpack
loader?