Having nameCache controls
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, webpack
- Lĩnh vực
- build-system, tooling
Hướng nghiên cứu
Bắt đầu bằng cách theo dõi việc xử lý tùy chọn hiện có của plugin và lệnh gọi Terser của nó; issue không nêu tên các tệp hoặc bài kiểm thử cụ thể. Sử dụng kịch bản Angular nhiều bundle được mô tả để xác minh rằng một nameCache được lưu bền vững có thể được cung cấp và cập nhật, đồng thời các bản build riêng biệt vẫn giữ được các tên đã minify tương thích.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
- Operating System: Windows
- Node Version: 13.5.0
- NPM Version: 6.13.4
- webpack Version: 4.41.2
- terser-webpack-plugin Version: 3.0.2
Feature Proposal
What about adding nameCache option? I haven't used it before, but as documentation suggests we should be able to tell terser to use js object (or it would be more correct to call it dictionary) to map names (as I guess variables, classes, functions) to predefined, new, minified names instead of just renaming them to alphabetically smallest, nonempty, available string.
To say it simply, I'm asking to bring this somehow possible in webpack plugin too:
var cacheFileName = "/tmp/cache.json";
var options = {
mangle: {
properties: true,
},
nameCache: JSON.parse(fs.readFileSync(cacheFileName, "utf8"))
};
fs.writeFileSync("part1.js", Terser.minify({
"file1.js": fs.readFileSync("file1.js", "utf8"),
"file2.js": fs.readFileSync("file2.js", "utf8")
}, options).code, "utf8");
fs.writeFileSync("part2.js", Terser.minify({
"file3.js": fs.readFileSync("file3.js", "utf8"),
"file4.js": fs.readFileSync("file4.js", "utf8")
}, options).code, "utf8");
fs.writeFileSync(cacheFileName, JSON.stringify(options.nameCache), "utf8");
And this code in my opinion also saves new names cache to same file too. I think this is impossible now in terser webpack plugin.
Feature Request: Add ability/option to bind json file as name cache.
Feature Use Case
<! -- problem -->
Easiest use case would be, I need to build application (currently in angular) which has more than two files bundled (let's assume 3). First and second files both have dependency on third.
Now if I build only first file, after minification first minified file will have for example console.log(thirdModule.thirdModuleVariable) transformed into console.log(thirdModule.a).
But if I only build second file or if I build whole project thirdModule's thirdModuleVariable may become b.
</!-- problem -->
What I want in the end is that in angular application I have appModule => [firstLazyModule, secondLazyModule, thirdLazyModule]. Now I will build whole app, then I will comment out other two modules and build only appModule => [firstLazyModule] (because building all three of them takes too long and I have only changed code in firstLazyModule, after building app with only one module, I will take generated module bundle and I will replace corresponding module file in the firstly generated directory with this new module bundle file.
This whole thing works if I don't use terser plugin, but doesn't work with terser because of the problem I have provided. If I'll have nameCache file in the project, each time I build app it will generate and use in next builds same minified variable names and replacing modules will still work.
I hope we can work this out. Thank you in advance.
- Ngôn ngữ chính
- JavaScript
- Star
- 2k
- Fork
- 165
- Merge trung bình
- 2 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của webpack/minimizer-webpack-plugin
-
Include HTML Minifier Next?Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
webpack/minimizer-webpack-plugin#684 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
webpack/minimizer-webpack-plugin#389 · 15 bình luận · 3 reaction ·
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
webpack/minimizer-webpack-plugin#175 · 6 bình luận ·
Tất cả issue của webpack/minimizer-webpack-plugin
Issue tương tự
-
Mend: dependency security vulnerability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
ManageIQ/manageiq-ui-service#2259 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
electerious/Ackee#411 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[bug] 提瓦特记事本原石检测框宽度较窄Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
babalae/bettergi-scripts-list#3905 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] "Configure Colota" opens Colota with "Invalid configuration: No configuration data in URL"Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 87/100
dedicatedcode/reitti#1445 ·
Maintainer thường phản hồi trong vòng 1 ngày