Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions templates/uui-nextjs-template/template/.eslintrc.json

This file was deleted.

6 changes: 6 additions & 0 deletions templates/uui-nextjs-template/template/@types/svg.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module '*.svg' {
import React from 'react';
export const ReactComponent: React.FunctionComponent<
React.SVGProps<SVGSVGElement>
>;
}
44 changes: 44 additions & 0 deletions templates/uui-nextjs-template/template/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { defineConfig } from 'eslint/config';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import prettier from 'eslint-plugin-prettier';
import tsParser from '@typescript-eslint/parser';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default defineConfig([
{
extends: compat.extends(
'next/core-web-vitals',
'plugin:prettier/recommended'
),

plugins: {
'@typescript-eslint': typescriptEslint,
prettier,
},

languageOptions: {
parser: tsParser,
},

settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts'],
},
},

rules: {
'prettier/prettier': 'error',
},
},
]);
2 changes: 1 addition & 1 deletion templates/uui-nextjs-template/template/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
40 changes: 37 additions & 3 deletions templates/uui-nextjs-template/template/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
productionBrowserSourceMaps: true
}
reactStrictMode: true,
productionBrowserSourceMaps: true,
turbopack: {
rules: {
'*.svg': {
loaders: [
{
loader: '@svgr/webpack',
options: {
icon: true,
template: require('./svgr-template.js'),
},
},
],
as: '*.js',
},
},
},
webpack: (config) => {
config.module.rules.push({
test: /\.svg$/,
issuer: /\.[jt]sx?$/,
use: [
{
loader: '@svgr/webpack',
options: {
icon: true,
template: require('./svgr-template.js'),
Copy link
Collaborator

@AlekseyManetov AlekseyManetov May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please elaborate why do we need template here? I see that it also add div wrapper for each icon, probably we can avoid it to not add unnecessary wrappers?
I've asked about config for one of our clients who also use next 15, they share following config

config.module.rules.push({
        test: /\.svg$/i,
        use: [
            {
                loader: '@svgr/webpack',
                options: {
                    svgoConfig: {
                        plugins: [
                            {
                                name: 'preset-default',
                                params: {
                                    overrides: {
                                        removeViewBox: false,
                                    },
                                },
                            },
                        ],
                    },
                },
            },
        ],

Probably name: 'preset-default' resolves issues which you try to resolve by template?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, I'll give it a try and update PR accordingly.

},
},
'url-loader',
],
});

return config;
},
};
Loading