Next-gen Typescript/Javascript package bundler.
- 📦 Typescript Supported
- 🛠️ Extendable Loader
$ npm i --save-dev asto
const { asto } = require('asto');
asto({
entryPoints: [
'src/index.ts',
{
input: 'assets',
output: 'dist/assets',
builder: 'asset',
},
],
});
You can build whenever a file changes with the watch option.
const { watch } = require('asto');
watch(
{
entryPoints: [
/* ... */
],
},
{
/* watch options */
}
).then(({ onChange }) =>
onChange(({ path }) => {
/* do something */
})
);
Asto's default loader is esbuild, but you can increase stability further with the webpack loader.
$ npm i --save-dev @asto/webpack
const { asto } = require('asto');
const { webpackLoader } = require('@asto/webpack');
asto({
loader: webpackLoader(
{
typescript: true, // for typescript
nodeExternals: true,
},
{
/* webpack options */
}
),
entryPoints: [
'src/index.ts',
{
// copy directory
input: 'assets',
output: 'dist/assets',
builder: 'asset',
},
],
});
Install a loader that converts commonjs code to esm!
warning: This loader is not suitable for production.
$ npm i --save-dev @asto/esm
const { asto } = require('asto');
const { esmLoader } = require('@asto/esm');
asto({
loader: esmLoader(),
entryPoints: [
{
input: 'src/index.js',
},
],
});
MIT