-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: embedding icons #132
Conversation
vite就不能像webpack一样直接加个loader了事吗,还要自己写资源文件到js的转换( |
preview url: https://pr-132--bangumi-next.netlify.app |
storybook preview url: https://pr-132-storybook--bangumi-next.netlify.app |
不知道为啥单元测试没过 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥会多两个 SVG?
是指两个箭头吗,我只是改了一下 fill,之前没 fill,导致 icon 默认透明 |
@@ -5,12 +5,12 @@ | |||
"scripts": { | |||
"prepare": "husky install", | |||
"preinstall": "npx only-allow pnpm", | |||
"build": "pnpm website build", | |||
"build": "pnpm icons build && pnpm website build", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉build越来越复杂了...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
还好吧,才两个build(
可以写下script,或者上turborepo
Preview DeploymentSites https://pr-132-sites--bangumi-next.netlify.app Storybook https://pr-132-storybook--bangumi-next.netlify.app |
// export all svg | ||
await writeFile(join(OUT_DIR, 'index.js'), indexContent, { encoding: 'utf-8' }); | ||
await writeFile(join(OUT_DIR, 'index.d.ts'), indexContent, { encoding: 'utf-8' }); | ||
} catch (error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里不用catch吧,catch了之后构建失败只有一个console.error了,依旧会去构建后面的website
Co-authored-by: Trim21 <[email protected]>
看了一下,是不是直接用这个就好了 |
其实现在已经是用了 |
那我理解错了... 所以原本就不会请求一堆小svg,只是单纯的有多于文件而已? |
是的 |
但是我感觉issue108不是这个意思?如果只是在build里有多余文件的话无所谓了。 |
实话说。。确实无所谓(我本身的目的也只是减小打包体积) |
我也是这么理解的 |
🤔所以其实我只是想顺带 close 一下108 而已,可能我在这个 PR 里 ref 了那个 issue 导致了一些误解( |
既然这样的话那就不合了 |
close #108
使用
vite-plugin-svgr
后就不用担心这个问题了。但打包文件中还是残留了多余的文件之前
现在