-
Notifications
You must be signed in to change notification settings - Fork 370
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(module-tools): put terser at the end of renderChunk to ensure min…
…ify (#4803)
- Loading branch information
Showing
5 changed files
with
36 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@modern-js/module-tools': patch | ||
--- | ||
|
||
fix(module-tools): put terser at the end of renderChunk to ensure minify | ||
fix(module-tools): 把 terser 放在 renderChunk 的最后阶段来确保全部代码压缩 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
tests/integration/module/fixtures/build/minify/__snapshots__/minify.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`minify usage umd + terser 1`] = `"var e,t;e=this,t=function(e,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"debug",{enumerable:!0,get:function(){return l}}),t=r(t);var n,o=Object.defineProperty,i=Object.getOwnPropertyNames,u={};((e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})})(u,{addPrefix:()=>n});var a,d,f=(a={"src/common.ts"(){n=(e,t)=>\`\${e}:\${t}\`}},function(){return a&&(d=(0,a[i(a)[0]])(a=0)),d}),l=e=>{return r=void 0,n=null,o=function*(){const{addPrefix:r}=yield Promise.resolve().then((()=>(f(),u)));r("DEBUG:",t.default.join(e))},new Promise(((e,t)=>{var i=e=>{try{a(o.next(e))}catch(r){t(r)}},u=e=>{try{a(o.throw(e))}catch(r){t(r)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,u);a((o=o.apply(r,n)).next())}));var r,n,o}},"object"===typeof module&&"object"===typeof module.exports?t(exports,require("path")):"function"===typeof define&&define.amd?define(["exports","path"],t):(e="undefined"!==typeof globalThis?globalThis:e||self)&&t(e.index={},e.path);"`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/integration/module/fixtures/build/minify/modern.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { defineConfig } from '@modern-js/module-tools/defineConfig'; | ||
|
||
export default defineConfig({ | ||
buildConfig: { | ||
buildType: 'bundle', | ||
input: ['./src/index.ts'], | ||
minify: 'terser', | ||
format: 'umd', | ||
outDir: './dist/umd', | ||
}, | ||
}); |