添加一些数据

This commit is contained in:
yuding
2026-04-21 15:07:49 +08:00
parent d60cc4448d
commit aeb4c990ad
24 changed files with 39086 additions and 26411 deletions

View File

@@ -23,23 +23,23 @@ import type { Plugin } from 'rollup';
*
* data URL 本身是绝对的,不需要 import.meta.url 作为 base因此这种替换是安全的。
*/
const fixWebpack5CompatPlugin = (): Plugin => ({
name: 'fix-webpack5-compat',
renderChunk(code) {
// 匹配 new URL("data:...", import.meta.url).href 或 new URL('data:...', import.meta.url).href
const fixed = code.replace(
/new URL\(["'](data:[^"']+)["'],\s*import\.meta\.url\)\.href/g,
'"$1"'
);
if (fixed !== code) {
console.log('[fix-webpack5-compat] Replaced new URL(data:..., import.meta.url) with direct data URL');
}
return {
code: fixed,
map: null,
};
},
});
// const fixWebpack5CompatPlugin = (): Plugin => ({
// name: 'fix-webpack5-compat',
// renderChunk(code) {
// // 匹配 new URL("data:...", import.meta.url).href 或 new URL('data:...', import.meta.url).href
// const fixed = code.replace(
// /new URL\(["'](data:[^"']+)["'],\s*import\.meta\.url\)\.href/g,
// '"$1"'
// );
// if (fixed !== code) {
// console.log('[fix-webpack5-compat] Replaced new URL(data:..., import.meta.url) with direct data URL');
// }
// return {
// code: fixed,
// map: null,
// };
// },
// });
export default defineConfig(() => {
return {
@@ -81,9 +81,9 @@ export default defineConfig(() => {
// 禁用代码分割,将所有代码打包到一个文件
inlineDynamicImports: true,
},
plugins: [
fixWebpack5CompatPlugin(),
],
// plugins: [
// fixWebpack5CompatPlugin(),
// ],
},
sourcemap: true,
emptyOutDir: true,