P粉7868001742023-08-18 15:16:11
You can add specific overrides in include
in tsconfig.
"include": [ "src/**/*", "node_modules/foo/index.ts", "node_modules/bar/quux.baz.mjs" ]
But when you package for the client, you usually don't include the dependencies as separate scripts, but let the packaging tool decide where to put them. You didn't mention what packaging tool you're currently using, but if you set allowJS: true
, Babel is not required - for example, the relevant changes to the Webpack config would be:
{ test: /\.(js|ts)$/, exclude: /node_modules\/(?!(foo|bar)\/).*/, // 这一行
However, if you want autofill, using @babel/preset-env
with a Browserslist string is probably the best option.