@vnejs/build 0.0.39 → 0.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/build",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "description": "Build tools for @vnejs",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -24,6 +24,7 @@ program
24
24
  program
25
25
  //
26
26
  .command("client")
27
+ .option("-m, --mode <mode>", "build mode (development | production)")
27
28
  .option("-w, --watch", "watch mode", false)
28
29
  .option("-q, --quiet", "no console mode", false)
29
30
  .action(async (options) => require("./client")(getRootDir())(options));
@@ -21,8 +21,12 @@ const isBundleModule = (id) => /(@vnejs[/\\]bundles\.|[/\\]bundles[/\\])/.test(i
21
21
 
22
22
  const isUisModule = (id) => /(@vnejs[/\\]uis\.|[/\\]uis[/\\])/.test(id);
23
23
 
24
+ const resolveMode = (options) =>
25
+ options.mode ?? (process.env.NODE_ENV === "development" ? "development" : "production");
26
+
24
27
  module.exports = (rootPath, options = {}) => {
25
- const isDev = process.env.NODE_ENV === "development";
28
+ const mode = resolveMode(options);
29
+ const isDev = mode === "development";
26
30
  const entryRoot = path.join(rootPath, entryDir);
27
31
  const distPath = path.join(rootPath, "dist");
28
32
  const entryFile = path.join(entryRoot, "index.js");
@@ -49,7 +53,7 @@ module.exports = (rootPath, options = {}) => {
49
53
  configFile: false,
50
54
  root: entryRoot,
51
55
  base: "./",
52
- mode: isDev ? "development" : "production",
56
+ mode,
53
57
  publicDir: false,
54
58
  logLevel: options.quiet ? "warn" : "info",
55
59
  define: {