@webpackon/use-ts
v1.0.1
Published
Webpackon use typescript
Downloads
3
Maintainers
Readme
@webpackon/use-ts
Features:
- synchronization tsconfig paths with webpack aliases
- adds typescript extensions
Install
npm i @webpackon/use-ts --save
yarn add @webpackon/use-ts
API
const { useTs } = require('@webpackon/use-ts');
useTs()(config: WebpackConfig)
Examples
Full examples are here
Example babel + ts
const path = require('path');
const { compose } = require('@webpackon/core');
const { useTs } = require('@webpackon/use-ts');
const { useBabel } = require('@webpackon/use-babel');
module.exports = (_, { mode }) =>
compose(
useBabel({ useTs: true }),
useTs(),
)({
target: 'web',
entry: path.resolve(__dirname, 'src', 'index.tsx'),
});
Example swc + ts
const path = require('path');
const { compose } = require('@webpackon/core');
const { useTs } = require('@webpackon/use-ts');
const { useSwc } = require('@webpackon/use-swc');
module.exports = (_, { mode }) =>
compose(
useSwc({ useTs: true }),
useTs(),
)({
target: 'web',
entry: path.resolve(__dirname, 'src', 'index.tsx'),
});