Skip to content

Commit d998335

Browse files
committed
fix: update vite config to rename compiled .pnpm.... files into pnpm...
1 parent a39d222 commit d998335

File tree

1 file changed

+6
-40
lines changed

1 file changed

+6
-40
lines changed

adminforth/spa/vite.config.ts

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,6 @@ async function getNextAvailablePort(startPort: number | undefined) {
1515
return await portfinder.getPortPromise({ port: startPort });
1616
};
1717

18-
function ignoreTailwindErrors(): Plugin {
19-
return {
20-
name: 'ignore-tailwind-errors',
21-
configureServer(server) {
22-
server.middlewares.use((req, res, next) => {
23-
const originalWrite = res.write;
24-
res.write = function(chunk) {
25-
if (typeof chunk === 'string' && chunk.includes('tailwind')) {
26-
return true;
27-
}
28-
return originalWrite.call(this, chunk);
29-
};
30-
next();
31-
});
32-
},
33-
config(config, { command }) {
34-
if (command === 'build') {
35-
// Override PostCSS config for build
36-
config.css = config.css || {};
37-
config.css.postcss = {
38-
plugins: [
39-
{
40-
postcssPlugin: 'ignore-tailwind-errors',
41-
Once(root, helpers) {
42-
try {
43-
return tailwindcss()(root, helpers);
44-
} catch (error: any) {
45-
console.warn('TailwindCSS warning ignored:', error.message);
46-
return;
47-
}
48-
}
49-
}
50-
]
51-
};
52-
}
53-
}
54-
};
55-
}
56-
57-
5818
const appPort = await getNextAvailablePort(5173);
5919
const hmrPort = await getNextAvailablePort(5273);
6020
console.log(`SPA port: ${appPort}. HMR port: ${hmrPort}`);
@@ -89,6 +49,12 @@ export default defineConfig({
8949
return id.toString().split('node_modules/')[1].split('/')[0].toString();
9050
}
9151
},
52+
assetFileNames: (assetInfo) => {
53+
return assetInfo.name?.startsWith('.pnpm')
54+
? assetInfo.name.replace(/^\.pnpm/, 'pnpm')
55+
: assetInfo.name;
56+
},
57+
9258
},
9359
},
9460
},

0 commit comments

Comments
 (0)