Skip to content

Commit

Permalink
feat: added a flag to skip memory generation for iterative development
Browse files Browse the repository at this point in the history
  • Loading branch information
3p3r committed Apr 14, 2024
1 parent 5d9d0b1 commit f2b9eb8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "browserify-webpack-plugin",
"version": "0.4.0",
"version": "0.5.0",
"description": "Simple, yet comprehensive webpack plugin to bundle almost any javascript/typescript project for modern browsers.",
"main": "./webpack.base.config.js",
"scripts": {
Expand Down
9 changes: 5 additions & 4 deletions webpack.base.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ const getKeyedEnvironmentVariables = (env: any, key: string) =>
.map(([_, value]) => value) || []) as string[];
const getExcludes = (env: any) => getKeyedEnvironmentVariables(env, "exclude");
const getIncludes = (env: any) => getKeyedEnvironmentVariables(env, "include");
const skipMemory = (env: any) => "skipMemory" in env;

class BrowserifyWebpackPlugin {
private readonly _name: string;
private readonly _includes: string[];
private readonly _excludes: string[];
constructor(private readonly env: any) {
this._includes = getIncludes(env);
this._excludes = getExcludes(env);
this._name = env?.memory || "mem.zip";
this._includes = getIncludes(this.env);
this._excludes = getExcludes(this.env);
this._name = this.env?.memory || "mem.zip";
}
apply(compiler: Compiler) {
log("applying %s", PLUGIN_ID);
Expand Down Expand Up @@ -158,7 +159,7 @@ const BaseConfig = (env: any, args: any): Partial<Configuration> => {
// console: require.resolve("console-browserify"),
Buffer: [require.resolve("buffer/"), "Buffer"],
}),
new BrowserifyWebpackPlugin(env),
...(skipMemory(env) ? [] : [new BrowserifyWebpackPlugin(env)]),
new HtmlWebpackPlugin({
title: "",
filename: "app.html",
Expand Down

0 comments on commit f2b9eb8

Please sign in to comment.