FranckFreiburger/vue3-sfc-loader

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

Open

#7 建立於 2020年12月16日

在 GitHub 查看
 (3 留言) (1 反應) (0 負責人)JavaScript (140 fork)github user discovery
enhancementhelp wanted

倉庫指標

Star
 (1,349 star)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

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.

貢獻者指南