Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 104 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/storybook-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
],
"dependencies": {
"@chialab/esbuild-plugin-commonjs": "^0.17.2",
"@rollup/plugin-alias": "^5.0.1",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.1",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/pluginutils": "^5.0.2",
"@storybook/core-common": "^7.0.0",
Expand All @@ -67,6 +70,7 @@
"path-browserify": "^1.0.1",
"rollup": "^3.25.1",
"rollup-plugin-external-globals": "^0.7.3",
"rollup-plugin-inject-process-env": "^1.3.1",
"slash": "^5.1.0"
},
"devDependencies": {
Expand Down
13 changes: 12 additions & 1 deletion packages/storybook-builder/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ import {
rollupPluginPrebundleModules,
} from './rollup-plugin-prebundle-modules';
import { rollupPluginStorybookBuilder } from './rollup-plugin-storybook-builder';
import rollupPluginCommonjs from '@rollup/plugin-commonjs';
import rollupPluginInjectProcessEnv from 'rollup-plugin-inject-process-env';
import rollupPluginJson from '@rollup/plugin-json';
import alias from '@rollup/plugin-alias';

const wdsPluginExternalGlobals = fromRollup(rollupPluginExternalGlobals);
const wdsPluginPrebundleModules = fromRollup(rollupPluginPrebundleModules);
Expand Down Expand Up @@ -144,7 +148,14 @@ export const build: WdsBuilder['build'] = async ({ startTime, options }) => {
extractAssets: false,
}),
rollupPluginNodeResolve(),
rollupPluginPrebundleModules(env),
alias({
entries: [
{ find: 'assert', replacement: 'browser-assert' },
]
}),
rollupPluginJson(),
rollupPluginCommonjs(),
rollupPluginInjectProcessEnv(env),
rollupPluginStorybookBuilder(options),
rollupPluginExternalGlobals(globals),
],
Expand Down
33 changes: 33 additions & 0 deletions packages/storybook-builder/src/rollup-plugin-prebundle-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,37 @@ export const CANDIDATES = [

// ESM, but uses `process.env.NODE_ENV`
'tiny-invariant',
/**
* dependency of '@storybook/react-dom-shim' (https://cdn.jsdelivr.net/npm/@storybook/react-dom-shim@7.5.1/dist/react-16.mjs)
* exports rely on commonjs: https://cdn.jsdelivr.net/npm/react-dom@18.2.0/index.js
*/
'react-dom',
/**
* dependency of '@storybook/theming' (https://cdn.jsdelivr.net/npm/@storybook/theming@7.5.1/dist/index.mjs)
* `import * as React from 'react';
* import { forwardRef, useContext } from 'react';`
* exports rely on commonjs: https://cdn.jsdelivr.net/npm/react@18.2.0/index.js
*/
'react',
/**
* dependency of '@storybook/theming' (https://cdn.jsdelivr.net/npm/@storybook/theming@7.5.1/dist/index.mjs)
* `import memoize2 from 'memoizerific';`
* exports rely on commonjs: https://cdn.jsdelivr.net/npm/memoizerific@1.11.3/src/memoizerific.js
*/
'memoizerific',
/**
* dependencies of '@storybook/blocks' (https://cdn.jsdelivr.net/npm/@storybook/blocks@7.5.1/dist/index.mjs)
* they all rely on commonjs (https://cdn.jsdelivr.net/npm/lodash@4.17.21/uniq.js for instance)
*/
'lodash/uniq.js',
'lodash/pickBy.js',
'lodash/cloneDeep.js',
'lodash/throttle.js',
/**
* dependency of '@storybook/dist/Color-[hash].msj' (https://cdn.jsdelivr.net/npm/@storybook/blocks@7.5.1/dist/Color-6VNJS4EI.mjs)
* exports rely on commonjs: https://cdn.jsdelivr.net/npm/color-convert@2.0.1/index.js
*/
'color-convert',
'tocbot',
'@storybook/blocks',
];