unocss-preset-forms icon indicating copy to clipboard operation
unocss-preset-forms copied to clipboard

Auto import gives invalid `import { presetForms } from "@julr/unocss-preset-forms/index";`

Open henrikvilhelmberglund opened this issue 9 months ago • 3 comments

minor issue but the auto import gives import { presetForms } from "@julr/unocss-preset-forms/index"; instead of import { presetForms } from "@julr/unocss-preset-forms";.

repro:

  1. have no import statement.
  2. install "@julr/unocss-preset-forms";
  3. write presetForms(); in the presets config and select the autoimport

henrikvilhelmberglund avatar Sep 18 '23 14:09 henrikvilhelmberglund

Looks like a moduleResolution related problem or something like that. Could you share tsconfig please? Otherwise, happy to receive a PR for that :pray:

Julien-R44 avatar Nov 12 '23 16:11 Julien-R44

Not sure how to fix it so I can't make a PR. It works for https://github.com/unpreset/unocss-preset-theme for example (no /index in that import) but I get /index here.

tsconfig.ts

{
	"extends": "./.svelte-kit/tsconfig.json",
	"compilerOptions": {
		"allowJs": true,
		"checkJs": true,
		"esModuleInterop": true,
		"forceConsistentCasingInFileNames": true,
		"resolveJsonModule": true,
		"skipLibCheck": true,
		"sourceMap": true,
		"strict": true
	}
	// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
	//
	// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
	// from the referenced tsconfig.json - TypeScript does not merge them in
}

extended one

{
	"compilerOptions": {
		"paths": {
			"$lib": [
				"../src/lib"
			],
			"$lib/*": [
				"../src/lib/*"
			]
		},
		"rootDirs": [
			"..",
			"./types"
		],
		"importsNotUsedAsValues": "error",
		"isolatedModules": true,
		"preserveValueImports": true,
		"lib": [
			"esnext",
			"DOM",
			"DOM.Iterable"
		],
		"moduleResolution": "node",
		"module": "esnext",
		"target": "esnext",
		"ignoreDeprecations": "5.0"
	},
	"include": [
		"ambient.d.ts",
		"./types/**/$types.d.ts",
		"../vite.config.ts",
		"../src/**/*.js",
		"../src/**/*.ts",
		"../src/**/*.svelte",
		"../tests/**/*.js",
		"../tests/**/*.ts",
		"../tests/**/*.svelte"
	],
	"exclude": [
		"../node_modules/**",
		"./[!ambient.d.ts]**",
		"../src/service-worker.js",
		"../src/service-worker.ts",
		"../src/service-worker.d.ts"
	]
}

henrikvilhelmberglund avatar Nov 12 '23 19:11 henrikvilhelmberglund

Thanks ! Gonna take a look asap

Julien-R44 avatar Nov 12 '23 20:11 Julien-R44