@pure-ds/storybook 0.3.13 → 0.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.js +18 -0
- package/package.json +1 -1
package/.storybook/main.js
CHANGED
|
@@ -159,6 +159,24 @@ const config = {
|
|
|
159
159
|
config.resolve.alias['@user/pds-config'] = resolve(currentDirname, '../default-pds.config.js');
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
// Support absolute path imports from user's public folder
|
|
163
|
+
// This allows stories to use imports like: import { html } from '/assets/js/lit.js';
|
|
164
|
+
const userPublicPath = resolve(process.cwd(), 'public');
|
|
165
|
+
if (process.cwd() !== resolve(currentDirname, '..') && fs.existsSync(userPublicPath)) {
|
|
166
|
+
const userAssetsPath = resolve(userPublicPath, 'assets');
|
|
167
|
+
if (fs.existsSync(userAssetsPath)) {
|
|
168
|
+
config.resolve.alias['/assets'] = userAssetsPath;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Allow Vite to serve files from user's public folder
|
|
172
|
+
config.server = config.server || {};
|
|
173
|
+
config.server.fs = config.server.fs || {};
|
|
174
|
+
config.server.fs.allow = [
|
|
175
|
+
...(config.server.fs.allow || []),
|
|
176
|
+
userPublicPath
|
|
177
|
+
];
|
|
178
|
+
}
|
|
179
|
+
|
|
162
180
|
// Set base path for production builds
|
|
163
181
|
if (config.mode === 'production') {
|
|
164
182
|
config.base = '/storybook/';
|