JupyterLab extension builder providing webpack-based compilation and build tools for JupyterLab extensions
—
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Command-line interface for building JupyterLab extensions with development and production modes, watch functionality, and source map generation.
build-labextension [options] <extensionPath>The build-labextension command provides a complete command-line interface for building JupyterLab extensions without requiring custom webpack configuration.
build-labextension [options] <extensionPath>
Options:
--development build in development mode (implies --source-map)
--source-map generate source maps
--core-path <path> the core package directory (required)
--static-url <url> url for build assets, if hosted outside the built extension
--watch enable watch mode for continuous building
-h, --help display help for command<extensionPath> - Path to the extension package directory to build--core-path <path> - Path to the core JupyterLab package directory (typically @jupyterlab/application)--development - Build in development mode with unminified output and source maps--source-map - Generate source maps for debugging (automatically enabled in development mode)--watch - Enable watch mode for continuous rebuilding on file changes--static-url <url> - Specify URL for build assets when hosted outside the extensionbuild-labextension ./my-extension --core-path ./node_modules/@jupyterlab/applicationbuild-labextension ./my-extension \
--core-path ./node_modules/@jupyterlab/application \
--development \
--watchbuild-labextension ./my-extension \
--core-path ./node_modules/@jupyterlab/application \
--static-url https://cdn.example.com/staticbuild-labextension ./my-extension \
--core-path ./node_modules/@jupyterlab/application \
--source-mapThe CLI tool performs the following build steps:
Production builds include:
Development builds provide:
build_log.jsonWhen --watch is enabled, the CLI provides:
Watch Mode Output:
webpack is watching the files…
Watch Compilation starting…
asset remoteEntry.abc123.js 245 KiB [emitted] [immutable] (name: main)
asset package.json 2.1 KiB [emitted]
Watch Compilation finishedThe CLI provides comprehensive error handling:
{
"scripts": {
"build": "build-labextension . --core-path ../application",
"build:dev": "build-labextension . --core-path ../application --development",
"watch": "build-labextension . --core-path ../application --watch"
}
}The CLI is designed to work well in continuous integration environments:
# Install dependencies
npm install
# Build extension for production
build-labextension ./packages/my-extension \
--core-path ./packages/application
# Check exit code
if [ $? -eq 0 ]; then
echo "Build successful"
else
echo "Build failed"
exit 1
fiFor monorepo setups with multiple extensions:
# Build multiple extensions
for ext in packages/*; do
if [ -f "$ext/package.json" ]; then
build-labextension "$ext" --core-path packages/application
fi
doneThe CLI generates the following output structure:
extension-package/
├── lib/ # Compiled TypeScript output
├── [outputDir]/ # Build output (default: lib)
│ ├── static/ # Static assets
│ │ ├── remoteEntry.[hash].js
│ │ └── [other assets]
│ ├── schemas/ # JSON schemas
│ ├── themes/ # Theme CSS files
│ ├── package.json # Updated with build metadata
│ └── build_log.json # Development mode onlyThe package.json in the output directory is updated with build metadata including the generated remoteEntry file path and exposed module information.