Skip to content
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

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

Open
henrikvilhelmberglund opened this issue Sep 18, 2023 · 3 comments

Comments

@henrikvilhelmberglund
Copy link

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
@Julien-R44
Copy link
Owner

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

@henrikvilhelmberglund
Copy link
Author

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"
	]
}

@Julien-R44
Copy link
Owner

Thanks ! Gonna take a look asap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants