@pure-ds/storybook 0.3.15 → 0.3.16
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 +5 -3
- package/package.json +1 -1
package/.storybook/main.js
CHANGED
|
@@ -167,14 +167,16 @@ const config = {
|
|
|
167
167
|
|
|
168
168
|
if (isConsumerProject && fs.existsSync(userPublicPath)) {
|
|
169
169
|
config.plugins = config.plugins || [];
|
|
170
|
-
|
|
170
|
+
// Insert at the beginning to run before other plugins
|
|
171
|
+
config.plugins.unshift({
|
|
171
172
|
name: 'pds-public-esm-loader',
|
|
172
|
-
|
|
173
|
+
enforce: 'pre', // Run before Vite's built-in plugins
|
|
174
|
+
resolveId(id, importer) {
|
|
173
175
|
// Handle absolute paths starting with /assets/ or other paths in public
|
|
174
176
|
if (id.startsWith('/') && !id.startsWith('/@') && !id.startsWith('/node_modules')) {
|
|
175
177
|
const filePath = resolve(userPublicPath, id.slice(1)); // Remove leading /
|
|
176
178
|
if (fs.existsSync(filePath) && (filePath.endsWith('.js') || filePath.endsWith('.mjs'))) {
|
|
177
|
-
// Return a virtual module ID
|
|
179
|
+
// Return a virtual module ID to bypass Vite's public folder check
|
|
178
180
|
return `\0virtual:public-esm:${id}`;
|
|
179
181
|
}
|
|
180
182
|
}
|