I am creating a series of components to be reused in the company I work for. We use typescript and so far I can create the components properly, transpile to javascript, and publish to npm. I only use the command line tsc
, I am not using webpack. My problem relies in a specific component that uses a css file. When I run the actual app that installs my npm package, it throws an error:
./~/my-common-components/dist/DataTable.js
Module not found: Can't resolve './DataTable.css' in '.\AdminPortal\admin-portal\node_modules\common-components\dist'
When I look at the dist folder of my transpiled code, the css file is not there.
I tried adding 'files' to the tsconfig.json
file and it does add it, but with the exact same path (src\DataTable.css
in stead of dist\DataTable.css
)
Is there a way to include that file in the final package without using webpack?