@a8k/babel-preset 中文文档教程
@a8k/babel-preset
This package includes the Babel preset used by a8k.
Please refer to its documentation:
- Getting Started – How to create a new app.
- User Config – How to custom config with a8k.
usage
width webpack-chain
chainConfig.module
.rule('ts')
.test(/\.(ts|tsx)$/)
.exclude.clear()
.add(/(\/|\\)node_modules(\/|\\)/)
.end()
.use('babel-loader')
.loader('babel-loader')
.options({
cacheDirectory: path.resolve(cacheDirectory, 'babel-loader'),
presets: [[require.resolve('@a8k/babel-preset'), { target: 'web' }]],
plugins: [],
});
options
typescript
target
支持:node
,web
node
: 构建 Nodejs 环境的代码
web
: 构建浏览器环境的代码