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

use babel source instead of babel packages (@babel/*) #7

Open
FranckFreiburger opened this issue Dec 16, 2020 · 2 comments
Open

use babel source instead of babel packages (@babel/*) #7

FranckFreiburger opened this issue Dec 16, 2020 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@FranckFreiburger
Copy link
Owner

FranckFreiburger commented Dec 16, 2020

I would like to embed babel using source version (github.com/babel) instead of packaged version (npm @babel/*) in order to benefits of a better (webpack) tree-shaking (@babel/* is cjs whereas github.com/babel is mjs/ts) and to reduce final bundle size.

I need to make TypeScript to resolve any node_modules/@babel/* to node_modules/babel/packages/babel-*/src

I tried with compilerOptions.paths with no success :

	paths: {
		'@babel/code-frame': ['babel/packages/babel-code-frame/src'],
	}

Is there a trick to make any require to @babel/* to point to babel/packages/babel-*/src ?

BTW, In the webpack configuration file, I use:

resolve: {
	alias: {
		'@babel/code-frame': 'babel/backages/babel-code-frame/src',

and I'm looking for the equivalent for typescript.

@FranckFreiburger FranckFreiburger added enhancement New feature or request help wanted Extra attention is needed labels Dec 16, 2020
@Toilal
Copy link
Contributor

Toilal commented Mar 9, 2021

I think aliases should also be defined in tsconfig in this case.

https://dev.to/larswaechter/path-aliases-with-typescript-in-nodejs-4353

I'm not sure this kink of wildcard expression is supported though ...

@FranckFreiburger
Copy link
Owner Author

(AFAIK) TypeScript cannot import flow files. My only option is to wait the resolution of Migrate Babel from Flow to TypeScript PR.

related stackoverflow question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants