Im creating my typeScript build using tsup, its reading the style.css file and making its build in the dist/index.css as well, but its not including its filename path in the file. I keep importing my filepath manually by doing import './index.css'
in the build folder.
//main.tsx
import '../assets/style.css';
const func = () => {
return (
//do something
);
};
export { func };
//index.ts
export * from "./src/types";
export * from "./src/main";
//tsup config
import { defineConfig } from 'tsup';
export default defineConfig({
format: ['cjs', 'esm'],
entry: ['./index.ts'],
dts: true,
shims: true,
skipNodeModulesBundle: true,
clean: true,
});
//typescript config
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"esModuleInterop": true,
"strictNullChecks": true,
"target": "ES2022",
"moduleResolution": "Node10",
"module": "CommonJS",
"declaration": true,
"isolatedModules": true,
"noEmit": true,
"outDir": "dist",
"jsx": "react"
},
"include": ["src", "custom.d.ts", "index.ts"],
"exclude": ["node_modules"]
}
//package.json
{
"name": "someFile",
"version": "1.0.12",
"description": "toast description",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsup --watch"
},
"keywords": [
"toast"
],
"author": "burhan",
"license": "ISC",
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"zustand": "^4.5.2"
},
"devDependencies": {
"@types/node": "^20.12.7",
"@types/react": "^18.3.0",
"autoprefixer": "^10.4.19",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tsup": "^8.0.2",
"typescript": "^5.4.5"
}
}
I’ve tried including postcss and tailwind as well but its not including the css path in the build index.js
New contributor
Burhan Shaikh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.