reactjs - React Typescript กับ microbundle-crl ไม่สร้างไฟล์ js สำหรับไฟล์ที่ไม่ใช่ไฟล์หลัก
โครงสร้างโฟลเดอร์ของฉันคือ
src/lib/componentA.tsx
src/index.tsx
หลังจากรันการสร้างโดยใช้ microbundle-crl ฉันได้รับดังต่อไปนี้
dist/lib/componentA.d.ts /* problem is that no js file is created at this path*/
dist/index.js
ฉันกำลังคาดหวังว่ามีไฟล์ dist/lib/componentA.js
{
"compilerOptions": {
"outDir": "dist",
"module": "esnext",
"lib": ["dom", "esnext"],
"moduleResolution": "node",
"jsx": "react",
"sourceMap": true,
"declaration": true,
"esModuleInterop": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true
},
"include": ["src"],
"exclude": ["node_modules", "dist", "example"]
}
ยินดีรับความช่วยเหลือทุกประเภท
คำตอบ #1
โปรดทราบว่า jest ที่กำลังรันจะปรับไฟล์ tsconfig.js ของคุณ
ฉันต้องทำการแทนที่ "allowJs": false ด้วยตัวเองเพื่อให้คำจำกัดความประเภทของฉันทำงานได้อย่างถูกต้อง อาจเป็นบางอย่างที่คล้ายกัน