-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
使用 esbuid-loader 提高前端代码的编译速度 #7525
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
Conversation
谢谢大神的指点,改好了。 |
@@ -4,7 +4,7 @@ const pkg = require("./package.json"); | |||
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); | |||
const {CleanWebpackPlugin} = require("clean-webpack-plugin"); | |||
// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; | |||
const TerserPlugin = require("terser-webpack-plugin"); |
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.
webpack.api.js 还没有修改,修改后 package.json 可对应移除
app/webpack.desktop.js
Outdated
@@ -54,27 +47,18 @@ module.exports = (env, argv) => { | |||
test: /\.js$/, | |||
include: [path.resolve(__dirname, "src/asset/pdf")], | |||
use: { | |||
loader: "babel-loader", |
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.
这段是为了支持 iPad 中 PDF 正常显示,这样使用确定没有问题么?
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.
谢谢V姐提醒,我没有设备,所有改回babel-loader了。
不过每次都要编译一遍 pdf.js,每次都多花7秒,是否可以提前编译它,避免转换?
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.
这个是需要修改的,不需要修改的会放在 stage 里面,没有改动的话应该是不会进行再次编译的。
稍后我看一下吧,可以的话我再改回去。
https://github.com/Hi-Windom/Sillot/blob/b9044515a3ee46e6841535dbbda7f834e7840845/app/src/sillot/util/sout.ts#L137 |
|
又检查了下,build 的时候走 optimization,keepNames 就没有必要为 true 了。dev 的时候不走 optimization,就不会替换名字。目前 dev 分之应该是不用修改了。 |
可以。思源没必要 keepNames ,我在自己的分支实现了。 |
这个牛! 速度起飞了 |
修改了
package.json
和 几个webpack.*.js
文件。添加esbuild-loader提升打包速度。