I have a "common library" written in Typescript and I want to use it in a couple more projects. I don't want to create a npm package from it, I just want to import it as "uncompiled package" but I'm having trouble setting this up. I tried adding ts-loader and excluding the module like this:
webpackConfig.module.rules.push({
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules\/((?!common-library).)*$/,
});
However, this results in Error: TypeScript emitted no output for /path/to/index,tsx.
I also tried using craco-babel-loader
https://github.com/rjerue/craco-babel-loader, however when adding it to the list of plugins:
{
plugin: rewireBabelLoader,
options: {
includes: [resolveApp('node_modules/common-library')],
excludes: [/node_modules/],
}
},
I'm getting the following:
C:\path\to\app\node_modules\@craco\craco\lib\loaders.js:34
rules.some((rule, index) => {
^
TypeError: rules.some is not a function