$ cnpm install @utoo/pack
???? High-performance bundler core for the Utoo toolchain, powered by Turbopack.
@utoo/pack is the engine behind the Utoo build system. It leverages the incremental computation power of Turbopack and the performance of Rust to provide a lightning-fast development and build experience.
webpack.config.js to simplify migration from Webpack.@utoo/pack aims for high compatibility with the Webpack ecosystem while providing superior performance.
name, import, and filename templates.loader-runner.alias and extensions.styled-jsx, styled-components).[!TIP] For a detailed status of all features, see the Features List.
ut install @utoo/pack --save-dev
You can use @utoo/pack directly in your Node.js scripts:
const { build, dev } = require('@utoo/pack');
// Production build
async function runBuild() {
await build({
config: {
entry: [
{
import: "./src/index.ts",
html: {
template: "./index.html"
}
}
],
output: {
path: "./dist",
filename: "[name].[contenthash:8].js",
chunkFilename: "[name].[contenthash:8].js",
clean: true
},
sourceMaps: true
}
});
}
// Development mode with HMR
async function startDev() {
const server = await dev({
config: {
entry: [
{
import: "./src/index.ts",
html: {
template: "./index.html"
}
}
],
output: {
path: "./dist",
filename: "[name].[contenthash:8].js",
chunkFilename: "[name].[contenthash:8].js",
clean: true
},
sourceMaps: true
}
});
}
@utoo/pack provides a partial compatibility layer for Webpack.
const { build } = require('@utoo/pack');
const webpackConfig = require('./webpack.config.js');
async function run() {
await build({ ...webpackConfig, webpackMode: true });
}
[!NOTE] Not all Webpack features and plugins are supported. Check the Features List for details on supported configuration options.
The bundler can be configured via a utoopack.json or through the programmatic API. Key configuration areas include:
entry: Define your application entry points.define: Build-time variable replacement.externals: Exclude specific dependencies from the bundle.mode: development or production.For a full list of options, see the Configuration Schema.
# Build Rust bindings and TypeScript modules
npm run build
Copyright 2013 - present © cnpmjs.org | Home |