@nlabs/lex 1.28.1 → 1.32.0

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.
@@ -6,32 +6,37 @@ var __getProtoOf = Object.getPrototypeOf;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
8
  var __export = (target, all) => {
9
- __markAsModule(target);
10
9
  for (var name in all)
11
10
  __defProp(target, name, { get: all[name], enumerable: true });
12
11
  };
13
- var __reExport = (target, module2, desc) => {
12
+ var __reExport = (target, module2, copyDefault, desc) => {
14
13
  if (module2 && typeof module2 === "object" || typeof module2 === "function") {
15
14
  for (let key of __getOwnPropNames(module2))
16
- if (!__hasOwnProp.call(target, key) && key !== "default")
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
17
16
  __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
18
17
  }
19
18
  return target;
20
19
  };
21
- var __toModule = (module2) => {
22
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
23
22
  };
24
- __export(exports, {
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var changelog_exports = {};
29
+ __export(changelog_exports, {
25
30
  createChangelog: () => createChangelog
26
31
  });
27
- var import_execa = __toModule(require("execa"));
28
- var import_fs = __toModule(require("fs"));
29
- var import_capitalize = __toModule(require("lodash/capitalize"));
30
- var import_isEmpty = __toModule(require("lodash/isEmpty"));
31
- var import_merge = __toModule(require("lodash/merge"));
32
- var import_luxon = __toModule(require("luxon"));
33
- var import_path = __toModule(require("path"));
34
- var import_utils = __toModule(require("../utils"));
32
+ var import_execa = __toESM(require("execa"));
33
+ var import_fs = __toESM(require("fs"));
34
+ var import_capitalize = __toESM(require("lodash/capitalize"));
35
+ var import_isEmpty = __toESM(require("lodash/isEmpty"));
36
+ var import_merge = __toESM(require("lodash/merge"));
37
+ var import_luxon = require("luxon");
38
+ var import_path = __toESM(require("path"));
39
+ var import_utils = require("../utils");
35
40
  const createChangelog = async ({ cliName, config, outputFile = "changelog.tmp.md", quiet }) => {
36
41
  const spinner = (0, import_utils.createSpinner)(quiet);
37
42
  const gitOptions = [
@@ -145,6 +150,7 @@ ${cliName} Error: ${error.message}`, "error", quiet);
145
150
  return error.status;
146
151
  }
147
152
  };
153
+ module.exports = __toCommonJS(changelog_exports);
148
154
  // Annotate the CommonJS export names for ESM import in node:
149
155
  0 && (module.exports = {
150
156
  createChangelog
package/dist/lex.js CHANGED
@@ -1,26 +1,8 @@
1
1
  #!/usr/bin/env node
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
9
- var __reExport = (target, module2, desc) => {
10
- if (module2 && typeof module2 === "object" || typeof module2 === "function") {
11
- for (let key of __getOwnPropNames(module2))
12
- if (!__hasOwnProp.call(target, key) && key !== "default")
13
- __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
14
- }
15
- return target;
16
- };
17
- var __toModule = (module2) => {
18
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
19
- };
20
- var import_commander = __toModule(require("commander"));
21
- var import_commands = __toModule(require("./commands"));
2
+ var import_commander = require("commander");
3
+ var import_commands = require("./commands");
22
4
  const packageConfig = require("../package.json");
23
- import_commander.program.command("build").option("-c, --config <path>", "Custom Webpack configuration file path (ie. webpack.config.js).").option("-l, --lexConfig <path>", "Lex configuration file path (lex.config.js).").option("-m, --mode <type>", 'Webpack mode ("production" or "development"). Default: "development".', /^(development|production)$/i, "development").option("-q, --quiet", "No Lex notifications printed in the console.").option("-r, --remove", "Removes all files from the output directory before compiling.").option("-s, --static", "Creates static HTML files when building app.").option("-t, --typescript", "Transpile as Typescript.").option("-v, --variables <name>", `Environment variables to set in "process.env". (ie. "{NODE_ENV: 'production'}").`).option("-w, --watch", "Watch for changes.").option("--sourcePath <path>", "Source path").option("--outputPath <path>", "Output path").option("--outputChunkFilename <filename>", "The output filename for additional chunks.").option("--outputFilename <filename>", 'The output filename of the bundle. Default: "[name].js".').option("--outputJsonpFunction <func>", 'The name of the JSONP function used for chunk loading. Default: "webpackJsonp".').option("--outputLibrary <library>", "Expose the exports of the entry point as library.").option("--outputLibraryTarget <target>", 'The type for exposing the exports of the entry point as library. Default: "var".').option("--outputPathinfo <hasInfo>", "The output filename for additional chunks. Default: false").option("--outputPublicPath <path>", 'The public path for the assets. Default: "/"').option("--outputSourceMapFilename <filename>", 'The output filename for the SourceMap. Default: "[name].map"').option("--buildDelimiter <delimiter>", 'Display custom text after build output. Default: "=== Build done ==="').action((cmd) => (0, import_commands.build)(cmd, process.exit).then(() => {
5
+ import_commander.program.command("build").option("-c, --config <path>", "Custom Webpack configuration file path (ie. webpack.config.js).").option("-l, --lexConfig <path>", "Lex configuration file path (lex.config.js).").option("-m, --mode <type>", 'Webpack mode ("production" or "development"). Default: "development".', /^(development|production)$/i, "development").option("-q, --quiet", "No Lex notifications printed in the console.").option("-r, --remove", "Removes all files from the output directory before compiling.").option("-s, --static", "Creates static HTML files when building app.").option("-t, --typescript", "Transpile as Typescript.").option("-v, --variables <name>", `Environment variables to set in "process.env". (ie. "{NODE_ENV: 'production'}").`).option("-w, --watch", "Watch for changes.").option("--bundler <name>", 'Bundler to use ("webpack" or "esbuild"). Default: "webpack".', /^(webpack|esbuild)$/i, "webpack").option("--sourcePath <path>", "Source path").option("--outputPath <path>", "Output path").option("--outputChunkFilename <filename>", "The output filename for additional chunks.").option("--outputFilename <filename>", 'The output filename of the bundle. Default: "[name].js".').option("--outputJsonpFunction <func>", 'The name of the JSONP function used for chunk loading. Default: "webpackJsonp".').option("--outputLibrary <library>", "Expose the exports of the entry point as library.").option("--outputLibraryTarget <target>", 'The type for exposing the exports of the entry point as library. Default: "var".').option("--outputPathinfo <hasInfo>", "The output filename for additional chunks. Default: false").option("--outputPublicPath <path>", 'The public path for the assets. Default: "/"').option("--outputSourceMapFilename <filename>", 'The output filename for the SourceMap. Default: "[name].map"').option("--buildDelimiter <delimiter>", 'Display custom text after build output. Default: "=== Build done ==="').action((cmd) => (0, import_commands.build)(cmd, process.exit).then(() => {
24
6
  }));
25
7
  import_commander.program.command("clean").option("-q, --quiet", "No Lex notifications printed in the console.").option("-s, --snapshots", 'Remove all "__snapshots__" directories.').action((cmd) => (0, import_commands.clean)(cmd, process.exit).then(() => {
26
8
  }));
package/dist/utils.js CHANGED
@@ -20,22 +20,27 @@ var __spreadValues = (a, b) => {
20
20
  };
21
21
  var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
22
22
  var __export = (target, all) => {
23
- __markAsModule(target);
24
23
  for (var name in all)
25
24
  __defProp(target, name, { get: all[name], enumerable: true });
26
25
  };
27
- var __reExport = (target, module2, desc) => {
26
+ var __reExport = (target, module2, copyDefault, desc) => {
28
27
  if (module2 && typeof module2 === "object" || typeof module2 === "function") {
29
28
  for (let key of __getOwnPropNames(module2))
30
- if (!__hasOwnProp.call(target, key) && key !== "default")
29
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
31
30
  __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
32
31
  }
33
32
  return target;
34
33
  };
35
- var __toModule = (module2) => {
36
- return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
34
+ var __toESM = (module2, isNodeMode) => {
35
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
37
36
  };
38
- __export(exports, {
37
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
38
+ return (module2, temp) => {
39
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
40
+ };
41
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
42
+ var utils_exports = {};
43
+ __export(utils_exports, {
39
44
  checkLinkedModules: () => checkLinkedModules,
40
45
  copyFileSync: () => copyFileSync,
41
46
  copyFiles: () => copyFiles,
@@ -55,16 +60,16 @@ __export(exports, {
55
60
  setPackageJson: () => setPackageJson,
56
61
  updateTemplateName: () => updateTemplateName
57
62
  });
58
- var import_boxen = __toModule(require("boxen"));
59
- var import_chalk = __toModule(require("chalk"));
60
- var import_find_file_up = __toModule(require("find-file-up"));
61
- var import_fs_extra = __toModule(require("fs-extra"));
62
- var import_glob = __toModule(require("glob"));
63
- var import_isEmpty = __toModule(require("lodash/isEmpty"));
64
- var import_ora = __toModule(require("ora"));
65
- var import_path = __toModule(require("path"));
66
- var import_rimraf = __toModule(require("rimraf"));
67
- var import_LexConfig = __toModule(require("./LexConfig"));
63
+ var import_boxen = __toESM(require("boxen"));
64
+ var import_chalk = __toESM(require("chalk"));
65
+ var import_find_file_up = __toESM(require("find-file-up"));
66
+ var import_fs_extra = __toESM(require("fs-extra"));
67
+ var import_glob = __toESM(require("glob"));
68
+ var import_isEmpty = __toESM(require("lodash/isEmpty"));
69
+ var import_ora = __toESM(require("ora"));
70
+ var import_path = __toESM(require("path"));
71
+ var import_rimraf = __toESM(require("rimraf"));
72
+ var import_LexConfig = require("./LexConfig");
68
73
  const cwd = process.cwd();
69
74
  const log = (message, type = "info", quiet = false) => {
70
75
  if (!quiet) {
@@ -283,6 +288,7 @@ const updateTemplateName = (filePath, replace, replaceCaps) => {
283
288
  data = data.replace(/Sample/g, replaceCaps);
284
289
  import_fs_extra.default.writeFileSync(filePath, data, "utf8");
285
290
  };
291
+ module.exports = __toCommonJS(utils_exports);
286
292
  // Annotate the CommonJS export names for ESM import in node:
287
293
  0 && (module.exports = {
288
294
  checkLinkedModules,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nlabs/lex",
3
- "version": "1.28.1",
3
+ "version": "1.32.0",
4
4
  "description": "Lex",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -45,99 +45,107 @@
45
45
  "watch": "NODE_ENV=development rm -rf dist && yarn compile -w"
46
46
  },
47
47
  "dependencies": {
48
- "@hot-loader/react-dom": "17.0.1",
48
+ "@hot-loader/react-dom": "17.0.2",
49
+ "@luckycatfactory/esbuild-graphql-loader": "^3.7.0",
49
50
  "@nlabs/gothamjs": "^0.8.2",
50
51
  "@nlabs/webpack-plugin-static-site": "^0.1.1",
51
- "acorn": "^8.5.0",
52
+ "acorn": "^8.7.0",
52
53
  "acorn-dynamic-import": "^4.0.0",
53
- "boxen": "^5.0.1",
54
- "caniuse-lite": "1.0.30001256",
54
+ "assert": "^2.0.0",
55
+ "boxen": "5.1.2",
56
+ "caniuse-lite": "1.0.30001305",
55
57
  "chalk": "^4.1.2",
56
58
  "commander": "^8.2.0",
57
- "compare-versions": "^3.6.0",
58
- "compression-webpack-plugin": "^8.0.1",
59
+ "compare-versions": "^4.1.3",
60
+ "compression-webpack-plugin": "^9.2.0",
59
61
  "config-webpack-plugin": "^1.1.0",
60
- "copy-webpack-plugin": "^9.0.1",
61
- "core-js": "^3.17.3",
62
+ "copy-webpack-plugin": "^10.2.4",
63
+ "core-js": "^3.21.0",
62
64
  "crypto-browserify": "^3.12.0",
63
- "css-loader": "^6.2.0",
64
- "cssnano": "^5.0.8",
65
- "dotenv-webpack": "^7.0.3",
65
+ "css-loader": "^6.6.0",
66
+ "cssnano": "^5.0.16",
67
+ "dotenv-webpack": "^7.1.0",
66
68
  "download-npm-package": "^3.1.12",
69
+ "esbuild": "^0.14.18",
67
70
  "esbuild-jest": "^0.5.0",
68
- "esbuild-loader": "^2.15.1",
69
- "execa": "^5.1.1",
70
- "exports-loader": "^3.0.0",
71
+ "esbuild-loader": "^2.18.0",
72
+ "execa": "5",
73
+ "exports-loader": "^3.1.0",
71
74
  "favicons-webpack-plugin": "^5.0.2",
72
75
  "file-loader": "^6.2.0",
73
76
  "find-file-up": "^2.0.1",
74
77
  "fs-extra": "^10.0.0",
75
- "glob": "^7.1.6",
76
- "graphql-tag": "^2.12.5",
77
- "html-loader": "^2.1.2",
78
- "html-webpack-plugin": "^5.3.2",
79
- "imports-loader": "^3.0.0",
80
- "jest": "^27.1.1",
81
- "jest-cli": "^27.1.1",
78
+ "glob": "^7.2.0",
79
+ "graphql": "^16.3.0",
80
+ "graphql-tag": "^2.12.6",
81
+ "html-loader": "^3.1.0",
82
+ "html-webpack-plugin": "^5.5.0",
83
+ "https-browserify": "^1.0.0",
84
+ "imports-loader": "^3.1.1",
85
+ "jest": "^27.4.7",
86
+ "jest-cli": "^27.4.7",
82
87
  "jest-transform-graphql": "^2.1.0",
83
88
  "json-d-ts": "^1.0.1",
84
89
  "latest-version": "5.1.0",
85
90
  "lodash": "^4.17.21",
86
- "luxon": "^2.0.2",
87
- "npm-check-updates": "^11.8.5",
88
- "obsolete-webpack-plugin": "^0.5.6",
91
+ "luxon": "^2.3.0",
92
+ "net": "^1.0.2",
93
+ "npm-check-updates": "^12.2.1",
89
94
  "ora": "5.4.1",
95
+ "os-browserify": "^0.3.0",
90
96
  "path-browserify": "^1.0.1",
91
97
  "postcss-browser-reporter": "^0.6.0",
92
- "postcss-cli": "^8.3.1",
93
- "postcss-custom-properties": "^11.0.0",
98
+ "postcss-cli": "^9.1.0",
99
+ "postcss-custom-properties": "^12.1.4",
94
100
  "postcss-flexbugs-fixes": "^5.0.2",
95
101
  "postcss-for": "^2.1.1",
96
102
  "postcss-hash": "^3.0.0",
97
103
  "postcss-import": "14.0.2",
98
- "postcss-loader": "^6.1.1",
99
- "postcss-nesting": "^8.0.1",
104
+ "postcss-loader": "^6.2.1",
105
+ "postcss-nesting": "^10.1.2",
100
106
  "postcss-percentage": "^0.0.0",
101
- "postcss-preset-env": "^6.7.0",
107
+ "postcss-preset-env": "^7.3.0",
102
108
  "postcss-simple-vars": "^6.0.3",
103
- "postcss-svgo": "5.0.2",
109
+ "postcss-svgo": "5.0.3",
104
110
  "postcss-url": "10.1.3",
105
111
  "process": "^0.11.10",
106
112
  "react": "^17.0.2",
107
113
  "react-dom": "^17.0.2",
108
114
  "regenerator-runtime": "^0.13.9",
109
- "resolve": "^1.20.0",
115
+ "resolve": "^1.22.0",
110
116
  "rimraf": "^3.0.2",
111
117
  "semver": "^7.3.5",
112
- "source-map-loader": "^3.0.0",
113
- "source-map-support": "^0.5.20",
118
+ "source-map-loader": "^3.0.1",
119
+ "source-map-support": "^0.5.21",
114
120
  "speed-measure-webpack-plugin": "^1.5.0",
115
121
  "static-site-generator-webpack-plugin": "^3.4.2",
116
122
  "stream-browserify": "^3.0.0",
117
- "style-loader": "^3.2.1",
118
- "svg-spritemap-webpack-plugin": "^4.3.2",
119
- "svgo": "2.5.0",
120
- "typescript": "^4.4.2",
123
+ "stream-http": "^3.2.0",
124
+ "style-loader": "^3.3.1",
125
+ "svg-spritemap-webpack-plugin": "^4.4.0",
126
+ "svgo": "2.8.0",
127
+ "tls": "^0.0.1",
128
+ "typescript": "^4.5.5",
121
129
  "url-loader": "^4.1.1",
122
130
  "util": "^0.12.4",
123
- "webpack": "5.52.1",
124
- "webpack-bundle-analyzer": "^4.4.1",
125
- "webpack-cli": "^4.8.0",
131
+ "webpack": "5.68.0",
132
+ "webpack-bundle-analyzer": "^4.5.0",
133
+ "webpack-cli": "^4.9.2",
126
134
  "webpack-merge": "^5.8.0",
127
135
  "webpack-nano": "^1.1.1",
128
- "webpack-plugin-serve": "^1.5.0"
136
+ "webpack-plugin-serve": "^1.6.0"
129
137
  },
130
138
  "devDependencies": {
131
- "@nlabs/execa-mock": "^1.28.0",
132
- "@types/jest": "^27.0.1",
133
- "@types/luxon": "^2.0.3",
134
- "@types/node": "^16.9.1",
139
+ "@nlabs/execa-mock": "^1.31.0",
140
+ "@types/jest": "^27.4.0",
141
+ "@types/luxon": "^2.0.9",
142
+ "@types/node": "^17.0.14",
135
143
  "@types/ora": "^3.2.0",
136
- "@types/react": "^17.0.20",
144
+ "@types/react": "^17.0.38",
137
145
  "@types/webpack": "^5.28.0",
138
- "eslint": "^7.32.0",
139
- "eslint-config-styleguidejs": "^1.5.3",
146
+ "eslint": "^8.8.0",
147
+ "eslint-config-styleguidejs": "^1.5.4",
140
148
  "lerna": "^4.0.0"
141
149
  },
142
- "gitHead": "b0a141b8b34c7122b9ab76f4b461f09fe3a10f6a"
150
+ "gitHead": "3b0984b831a687a1d274bb8ebf14f2cbb2a66c8a"
143
151
  }
package/webpack.config.js CHANGED
@@ -12,7 +12,6 @@ const fs = require('fs');
12
12
  const glob = require('glob');
13
13
  const HtmlWebPackPlugin = require('html-webpack-plugin');
14
14
  const isEmpty = require('lodash/isEmpty');
15
- const ObsoletePlugin = require('obsolete-webpack-plugin');
16
15
  const path = require('path');
17
16
  const SVGSpritemapPlugin = require('svg-spritemap-webpack-plugin');
18
17
  const webpack = require('webpack');
@@ -23,8 +22,7 @@ const {WebpackPluginServe} = require('webpack-plugin-serve');
23
22
  const {getNodePath, relativeFilePath} = require('./dist/utils');
24
23
 
25
24
  const {ProgressPlugin, ProvidePlugin} = webpack;
26
- const environment = process.env.NODE_ENV || 'development';
27
- const isProduction = environment === 'production';
25
+ const isProduction = process.env.NODE_ENV === 'production';
28
26
  const lexConfig = JSON.parse(process.env.LEX_CONFIG) || {};
29
27
 
30
28
  const {
@@ -36,7 +34,7 @@ const {
36
34
  libraryName,
37
35
  libraryTarget,
38
36
  preset,
39
- targetEnvironment,
37
+ targetEnvironment = 'es2015',
40
38
  webpack: webpackCustom
41
39
  } = lexConfig;
42
40
 
@@ -49,27 +47,18 @@ const plugins = [
49
47
  dependencies: true,
50
48
  percentBy: null
51
49
  }),
52
- new ProvidePlugin({process: 'process/browser'}),
53
- new DotenvPlugin({path: path.resolve(process.cwd(), '.env'), systemvars: true}),
54
- new CompressionWebpackPlugin({algorithm: 'gzip'}),
55
- new ObsoletePlugin({
56
- name: 'obsolete',
57
- promptOnNonTargetBrowser: true,
58
- template: `
59
- <div style="background-color: rgb(32, 41, 69); opacity: 0.8; height: 100%; width: 100%; margin: 0; padding: 0; position: absolute; text-align: center; left: 0; right: 0; bottom: 0; top: 0;">
60
- <div style="color: white; font-size: 20px; margin-top: 10%">
61
- Your browser is not supported.<br/><br/>
62
- Please use a recent
63
- <a href="https://www.microsoft.com/en-us/edge" style="color:white">Edge</a>,
64
- <a href="https://www.mozilla.org/en-US/firefox/new/" style="color:white">Firefox</a>,
65
- <a href="https://www.google.com/chrome/" style="color:white">Chrome</a> or
66
- Safari.
67
- </div>
68
- </div>
69
- `
70
- })
50
+ new DotenvPlugin({path: path.resolve(process.cwd(), '.env'), systemvars: false})
71
51
  ];
72
52
 
53
+ const isWeb = (preset || targetEnvironment) === 'web';
54
+
55
+ if(isWeb) {
56
+ plugins.push(
57
+ new CompressionWebpackPlugin({algorithm: 'gzip'}),
58
+ new ProvidePlugin({process: 'process/browser'})
59
+ );
60
+ }
61
+
73
62
  // Add svg files
74
63
  const globOptions = {
75
64
  cwd: sourceFullPath,
@@ -131,7 +120,7 @@ let outputFilename = outputFile;
131
120
 
132
121
  if(outputFile) {
133
122
  outputFilename = outputFile;
134
- } else if(outputHash || isProduction) {
123
+ } else if(outputHash || (isWeb && isProduction)) {
135
124
  outputFilename = '[name].[hash].js';
136
125
  } else {
137
126
  outputFilename = '[name].js';
@@ -154,6 +143,7 @@ const aliasPaths = {
154
143
  '@nlabs/arkhamjs': relativeFilePath('node_modules/@nlabs/arkhamjs', process.cwd()),
155
144
  '@nlabs/arkhamjs-utils-react': relativeFilePath('node_modules/@nlabs/arkhamjs-utils-react', process.cwd()),
156
145
  'core-js': getNodePath('core-js'),
146
+ process: relativeFilePath('node_modules/process', process.cwd()),
157
147
  react: relativeFilePath('node_modules/react', process.cwd()),
158
148
  'react-dom': relativeFilePath('node_modules/react-dom', process.cwd()),
159
149
  'regenerator-runtime': getNodePath('regenerator-runtime')
@@ -173,12 +163,12 @@ module.exports = (webpackEnv, webpackOptions) => {
173
163
  const webpackConfig = {
174
164
  bail: true,
175
165
  cache: !isProduction,
176
- devtool: isProduction ? 'cheap-module-source-map' : 'eval-cheap-module-source-map',
166
+ devtool: isProduction ? 'inline-cheap-module-source-map' : 'eval-cheap-module-source-map',
177
167
  entry: {
178
168
  index: `${sourceFullPath}/${lexConfig.entryJs}`
179
169
  },
180
170
  ignoreWarnings: [/Failed to parse source map/],
181
- mode: environment,
171
+ mode: isProduction ? 'production' : 'development',
182
172
  module: {
183
173
  rules: [
184
174
  {
@@ -204,7 +194,7 @@ module.exports = (webpackEnv, webpackOptions) => {
204
194
  loader: esbuildLoaderPath,
205
195
  options: {
206
196
  loader: 'tsx',
207
- target: 'es2015'
197
+ target: targetEnvironment
208
198
  },
209
199
  test: /\.(ts|tsx|js)$/
210
200
  },
@@ -288,11 +278,11 @@ module.exports = (webpackEnv, webpackOptions) => {
288
278
  }
289
279
  ]
290
280
  },
291
- optimization: !isProduction || libraryName ? {} : {
281
+ optimization: (isProduction && isWeb) ? {
292
282
  minimizer: [
293
283
  new ESBuildMinifyPlugin({
294
284
  css: true,
295
- target: 'es2015'
285
+ target: targetEnvironment
296
286
  })
297
287
  ],
298
288
  runtimeChunk: 'single',
@@ -307,7 +297,7 @@ module.exports = (webpackEnv, webpackOptions) => {
307
297
  }
308
298
  },
309
299
  usedExports: true
310
- },
300
+ } : {},
311
301
  output: {
312
302
  filename: outputFilename,
313
303
  library: libraryName,
@@ -321,7 +311,12 @@ module.exports = (webpackEnv, webpackOptions) => {
321
311
  alias,
322
312
  extensions: ['*', '.mjs', '.js', '.ts', '.tsx', '.jsx', '.json', '.gql', '.graphql'],
323
313
  fallback: {
314
+ assert: require.resolve('assert/'),
324
315
  crypto: require.resolve('crypto-browserify'),
316
+ fs: require.resolve('fs-extra'),
317
+ http: require.resolve('stream-http'),
318
+ https: require.resolve('https-browserify'),
319
+ os: require.resolve('os-browserify/browser'),
325
320
  path: require.resolve('path-browserify'),
326
321
  process: require.resolve('process/browser'),
327
322
  stream: require.resolve('stream-browserify'),
@@ -336,7 +331,7 @@ module.exports = (webpackEnv, webpackOptions) => {
336
331
  // stats: {
337
332
  // warningsFilter: [/Failed to parse source map/]
338
333
  // },
339
- target: preset || targetEnvironment
334
+ target: isWeb ? 'web' : 'node'
340
335
  };
341
336
 
342
337
  // Add development plugins