Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tsconfig-path support out of the box #13

Open
playerx opened this issue Mar 11, 2019 · 1 comment
Open

add tsconfig-path support out of the box #13

playerx opened this issue Mar 11, 2019 · 1 comment

Comments

@playerx
Copy link
Member

playerx commented Mar 11, 2019

scripts/tsconfig-register.js

const tsConfig = require('../tsconfig.json');
const tsConfigPaths = require('tsconfig-paths');

const baseUrl = tsConfig.compilerOptions.outDir;
tsConfigPaths.register({
	baseUrl,
	paths: tsConfig.compilerOptions.paths || [],
});

package.json

"scripts": {
	"start": "node -r ./scripts/tsconfig-register.js -r dotenv/config dist"
},
"jest": {
	"moduleNameMapper": {
		"@modules/(.*)": "<rootDir>/src/@modules/$1",
		"@/(.*)": "<rootDir>/src/$1"
	},
}
yarn add tsconfig-paths
@playerx
Copy link
Member Author

playerx commented Mar 11, 2019

tsconfig.json

{
	"baseUrl": ".",
	"paths": {
		"@modules/*": [
			"src/@modules/*"
		],
		"@/*": [
			"src/*"
		]
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant