-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to compile --> svg?sprite #71
Comments
Hi @lehnavid and sorry for the late response. The problem is actually in your next.config.js file. You are defining the webpack config within the plugins array which overwrites the webpack config which next-optimized-images added. If you move this object out of the array and provide it as the second parameter to the // next.config.js
module.exports = withPlugins([
optimizedImages,
], {
webpack(config) {
config.resolve.alias["components"] = path.join(
__dirname,
"src/components"
);
config.resolve.alias["containers"] = path.join(
__dirname,
"src/containers"
);
config.resolve.alias["helpers"] = path.join(__dirname, "src/helpers");
config.resolve.alias["api"] = path.join(__dirname, "src/api");
config.resolve.alias["store"] = path.join(__dirname, "src/store");
config.resolve.alias["routes"] = path.join(__dirname, "src/routes");
config.resolve.alias["config"] = path.join(__dirname, "src/config");
config.resolve.alias["theme"] = path.join(__dirname, "src/theme");
return config;
}
}); Does this also work in your project? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Cyril,
thanks for the great package.
I followed the steps to import svgs and use them as components as described.
But i get the following error:
I expected that i can import my svg file from any location and use it as a react component.
Below you can find my setup. I used yarn for everything instead of npm.
For Example:
My package.json:
My next.config.js:
The svg:
I also adjusted the _document.js and added:
The text was updated successfully, but these errors were encountered: