Anonymous
Erstellt NPM -Paket, aber nicht in der Lage, :: Modul nicht gefunden zu werden:
Post
by Anonymous » 15 Feb 2025, 11:40
Ich habe die React -Komponente erstellt und versucht, das Paket davon zu erstellen und zu veröffentlichen. Modul nicht gefunden . Auch wenn es in den Knotenmodulen vorhanden ist.
Code: Select all
{
"name": "field-input",
"version": "0.0.1",
"description": "Input Field Component",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsup",
"lint": "tsc"
},
"keywords": [
"react",
"component",
"input",
"field"
],
"author": "fastkit",
"license": "ISC",
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"dependencies": {
"lodash": "^4.17.21",
"lucide-react": "^0.475.0"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.0.6",
"@tsconfig/recommended": "^1.0.8",
"@types/lodash.debounce": "^4.0.9",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"autoprefixer": "^10.4.20",
"esbuild": "^0.25.0",
"esbuild-css-modules-plugin": "^3.1.4",
"postcss": "^8.5.2",
"tailwindcss": "^4.0.6",
"tsup": "^8.3.6",
"typescript": "^5.7.3"
}
}
TSConfig.ts
Code: Select all
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"esModuleInterop": true,
"strictNullChecks": true,
"target": "ESNext",
"moduleResolution": "node",
"module": "ESNext",
"declaration": true,
"jsx": "react-jsx",
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules"]
}
TSUP.CONFIG.TS
Code: Select all
import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/index.ts"],
format: ["esm", "cjs"],
minify: true,
dts: true,
outDir: "dist",
sourcemap: true,
clean: true,
});
/src/index.ts
Code: Select all
import "./index.css";
import FieldInput from "./FieldInput";
export default FieldInput;
/src/index.tsx
Verwendung
Code: Select all
"use client"
import FieldInput from "field-input";
export default function Home() {
return (
);
}
1739616003
Anonymous
Ich habe die React -Komponente erstellt und versucht, das Paket davon zu erstellen und zu veröffentlichen. Modul nicht gefunden . Auch wenn es in den Knotenmodulen vorhanden ist.[code]{ "name": "field-input", "version": "0.0.1", "description": "Input Field Component", "main": "dist/index.js", "module": "dist/index.mjs", "types": "dist/index.d.ts", "scripts": { "build": "tsup", "lint": "tsc" }, "keywords": [ "react", "component", "input", "field" ], "author": "fastkit", "license": "ISC", "peerDependencies": { "react": "^18.2.0", "react-dom": "^18.2.0" }, "dependencies": { "lodash": "^4.17.21", "lucide-react": "^0.475.0" }, "devDependencies": { "@tailwindcss/postcss": "^4.0.6", "@tsconfig/recommended": "^1.0.8", "@types/lodash.debounce": "^4.0.9", "@types/react": "^18.3.18", "@types/react-dom": "^18.3.5", "autoprefixer": "^10.4.20", "esbuild": "^0.25.0", "esbuild-css-modules-plugin": "^3.1.4", "postcss": "^8.5.2", "tailwindcss": "^4.0.6", "tsup": "^8.3.6", "typescript": "^5.7.3" } } [/code] [b]TSConfig.ts[/b] [code]{ "compilerOptions": { "strict": true, "noImplicitAny": true, "esModuleInterop": true, "strictNullChecks": true, "target": "ESNext", "moduleResolution": "node", "module": "ESNext", "declaration": true, "jsx": "react-jsx", "outDir": "dist" }, "include": ["src"], "exclude": ["node_modules"] } [/code] [b]TSUP.CONFIG.TS[/b] [code]import { defineConfig } from "tsup"; export default defineConfig({ entry: ["src/index.ts"], format: ["esm", "cjs"], minify: true, dts: true, outDir: "dist", sourcemap: true, clean: true, }); [/code] [b]/src/index.ts[/b] [code]import "./index.css"; import FieldInput from "./FieldInput"; export default FieldInput; [/code] [b]/src/index.tsx[/b] [code]React Component [/code] [b] Verwendung [/b] [code]"use client" import FieldInput from "field-input"; export default function Home() { return ( ); } [/code]