
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
@analogjs/storybook-angular
Advanced tools
Integration package for Storybook using Angular & Vite.
If you don't have Storybook setup already, run the following command to initialize Storybook for your project:
npx storybook@latest init
Follow the provided prompts, and commit your changes.
Install the Storybook Plugin for Angular and Vite. Depending on your preferred package manager, run one of the following commands:
npm install @analogjs/storybook-angular --save-dev
Add the zone.js
import to the top of the .storybook/preview.ts
file.
import 'zone.js';
import { applicationConfig, type Preview } from '@analogjs/storybook-angular';
import { provideNoopAnimations } from '@angular/platform-browser/animations';
const preview: Preview = {
decorators: [
applicationConfig({
providers: [provideNoopAnimations()],
}),
],
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};
export default preview;
Next, update the .storybook/main.ts
file to use the StorybookConfig
. Also update the framework
to use the @analogjs/storybook-angular
package.
import { StorybookConfig } from '@analogjs/storybook-angular';
const config: StorybookConfig = {
// other config, addons, etc.
framework: {
name: '@analogjs/storybook-angular',
options: {},
},
};
Remove the existing webpackFinal
config function if present.
Next, update the Storybook builders in the angular.json
or project.json
.
"storybook": {
"builder": "@analogjs/storybook-angular:start-storybook",
},
"build-storybook": {
"builder": "@analogjs/storybook-angular:build-storybook"
}
Remove any webpack
specific options and remove the browserTarget
option.
Add the /storybook-static
folder to your .gitignore
file.
Run the command for starting the development server.
npm run storybook
Run the command for building the storybook.
npm run build-storybook
To load shared CSS paths, configure them using loadPaths
css option in the viteFinal
function.
import path from 'node:path';
import { UserConfig, mergeConfig } from 'vite';
export async function viteFinal(config: UserConfig) {
return mergeConfig(config, {
css: {
preprocessorOptions: {
scss: {
loadPaths: `${path.resolve(__dirname, '../src/lib/styles')}`,
},
},
},
});
}
If you are using paths
in your tsconfig.json
, support for those aliases can be added to the vite.config.ts
.
First, install the vite-tsconfig-paths
package.
npm install vite-tsconfig-paths --save-dev
Next, add the plugin to the plugins
array in the .storybook/main.ts
.
import viteTsConfigPaths from 'vite-tsconfig-paths';
import { UserConfig, mergeConfig } from 'vite';
export async function viteFinal(config: UserConfig) {
return mergeConfig(config, {
plugins: [viteTsConfigPaths()],
});
}
For Nx workspaces, import and use the nxViteTsPaths
plugin from the @nx/vite
package. Add the plugin to the plugins
array in the .storybook/main.ts
.
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { UserConfig, mergeConfig } from 'vite';
export async function viteFinal(config: UserConfig) {
return mergeConfig(config, {
plugins: [nxViteTsPaths()],
});
}
You can also use the replaceFiles()
plugin from Nx to replace files during your build.
Import the plugin and set it up:
import { replaceFiles } from '@nx/vite/plugins/rollup-replace-files.plugin';
import { UserConfig, mergeConfig } from 'vite';
export async function viteFinal(config: UserConfig) {
return mergeConfig(config, {
plugins: [
replaceFiles([
{
replace: './src/one.ts',
with: './src/two.ts',
},
]),
],
});
}
Adding the replacement files to files
array in the tsconfig.app.json
may also be necessary.
{
"extends": "./tsconfig.json",
// other config
"files": ["src/main.ts", "src/main.server.ts", "src/two.ts"]
}
1.19.1 (2025-07-08)
FAQs
Storybook Integration for Angular & Vite
We found that @analogjs/storybook-angular demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.