Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli-plugin-service): clear asset dir
- Loading branch information
1 parent
63018a6
commit 5979ee7
Showing
9 changed files
with
59 additions
and
35 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
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
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
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
21 changes: 21 additions & 0 deletions
21
packages/@luban/cli-plugin-service/src/config/performance.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,21 @@ | ||
import { ConfigPluginInstance, ConfigPluginApplyCallbackArgs } from "../definitions"; | ||
|
||
class Performance implements ConfigPluginInstance { | ||
apply(args: ConfigPluginApplyCallbackArgs) { | ||
const { api } = args; | ||
|
||
const isProduction = process.env.NODE_ENV === "production"; | ||
|
||
api.chainWebpack("client", (webpackConfig) => { | ||
webpackConfig.performance | ||
.hints(isProduction ? "warning" : false) | ||
// max entry point size 1M | ||
.maxEntrypointSize(1048576) | ||
// max asset size 256kb | ||
.maxAssetSize(262144) | ||
.end(); | ||
}); | ||
} | ||
} | ||
|
||
export default Performance; |
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
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
7 changes: 7 additions & 0 deletions
7
packages/@luban/cli-plugin-service/src/utils/cleanAssetPath.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,7 @@ | ||
export function cleanAssetPath(path: string) { | ||
return path.replace(/(\/{2,})/g, "/").replace(/^\/|\/$/g, ""); | ||
} | ||
|
||
export function removeSlash(path: string) { | ||
return path.replace(/^\/|\/$/g, ""); | ||
} |
4 changes: 3 additions & 1 deletion
4
...ban/cli-plugin-service/src/utils/clean.ts → ...cli-plugin-service/src/utils/cleanDest.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