@workleap/webpack-configs 1.0.4 → 1.0.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @workleap/webpack-configs
2
2
 
3
+ ## 1.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#131](https://github.com/gsoft-inc/wl-web-configs/pull/131) [`11bb287`](https://github.com/gsoft-inc/wl-web-configs/commit/11bb287847b4f525faa83abd23e46c56f58e41f4) Thanks [@patricklafrance](https://github.com/patricklafrance)! - Added a default key to exports
8
+
3
9
  ## 1.0.4
4
10
 
5
11
  ### Patch Changes
package/dist/build.d.ts CHANGED
@@ -21,7 +21,7 @@ interface DefineBuildConfigOptions {
21
21
  cssModules?: boolean;
22
22
  environmentVariables?: Record<string, unknown>;
23
23
  transformers?: WebpackConfigTransformer[];
24
- profile?: boolean;
24
+ verbose?: boolean;
25
25
  }
26
26
  declare function defineBuildConfig(swcConfig: Config, options?: DefineBuildConfigOptions): Configuration;
27
27
 
package/dist/build.js CHANGED
@@ -1,3 +1,3 @@
1
- export { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig } from './chunk-NQR5SLK3.js';
1
+ export { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig } from './chunk-GFNG2PBM.js';
2
2
  import './chunk-P2Z3EEVF.js';
3
- import './chunk-EF2WO5MC.js';
3
+ import './chunk-QJI26K46.js';
@@ -1,5 +1,5 @@
1
1
  import { isObject } from './chunk-P2Z3EEVF.js';
2
- import { applyTransformers } from './chunk-EF2WO5MC.js';
2
+ import { applyTransformers } from './chunk-QJI26K46.js';
3
3
  import HtmlWebpackPlugin from 'html-webpack-plugin';
4
4
  import MiniCssExtractPlugin from 'mini-css-extract-plugin';
5
5
  import { createRequire } from 'node:module';
@@ -30,7 +30,15 @@ function defineMiniCssExtractPluginConfig(options = {}) {
30
30
  filename
31
31
  };
32
32
  }
33
+ function preflight(options) {
34
+ if (options.publicPath) {
35
+ if (!options.publicPath.endsWith("/")) {
36
+ throw new Error('[webpack-configs] The "publicPath" must end with a "/".');
37
+ }
38
+ }
39
+ }
33
40
  function defineBuildConfig(swcConfig, options = {}) {
41
+ preflight(options);
34
42
  const {
35
43
  entry = path.resolve("./src/index.tsx"),
36
44
  outputPath = path.resolve("dist"),
@@ -48,7 +56,7 @@ function defineBuildConfig(swcConfig, options = {}) {
48
56
  // "process.env" is always available.
49
57
  environmentVariables = {},
50
58
  transformers = [],
51
- profile = false
59
+ verbose = false
52
60
  } = options;
53
61
  const config = {
54
62
  mode: "production",
@@ -100,7 +108,7 @@ function defineBuildConfig(swcConfig, options = {}) {
100
108
  })
101
109
  ]
102
110
  } : void 0,
103
- infrastructureLogging: profile ? {
111
+ infrastructureLogging: verbose ? {
104
112
  appendOnly: true,
105
113
  level: "verbose",
106
114
  debug: /PackFileCache/
@@ -172,7 +180,7 @@ function defineBuildConfig(swcConfig, options = {}) {
172
180
  };
173
181
  const transformedConfig = applyTransformers(config, transformers, {
174
182
  environment: "build",
175
- profile
183
+ verbose
176
184
  });
177
185
  return transformedConfig;
178
186
  }
@@ -1,5 +1,5 @@
1
1
  import { isObject } from './chunk-P2Z3EEVF.js';
2
- import { applyTransformers } from './chunk-EF2WO5MC.js';
2
+ import { applyTransformers } from './chunk-QJI26K46.js';
3
3
  import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
4
4
  import HtmlWebpackPlugin from 'html-webpack-plugin';
5
5
  import { createRequire } from 'node:module';
@@ -23,15 +23,10 @@ function defineDevHtmlWebpackPluginConfig(options = {}) {
23
23
  function defineFastRefreshPluginConfig(options = {}) {
24
24
  return options;
25
25
  }
26
- function preflight(options) {
26
+ function preflight() {
27
27
  if (!require2.resolve("webpack-dev-server")) {
28
28
  throw new Error('[webpack-configs] To use the "dev" config, install https://www.npmjs.com/package/webpack-dev-server as a "devDependency".');
29
29
  }
30
- if (options.fastRefresh) {
31
- if (!require2.resolve("@pmmmwh/react-refresh-webpack-plugin")) {
32
- throw new Error('[webpack-configs] To use Webpack Fast Refresh, install https://www.npmjs.com/package/@pmmmwh/react-refresh-webpack-plugin as a "devDependency".');
33
- }
34
- }
35
30
  }
36
31
  function trySetSwcFastRefresh(config, enabled) {
37
32
  if (config?.jsc?.transform?.react) {
@@ -40,7 +35,7 @@ function trySetSwcFastRefresh(config, enabled) {
40
35
  return config;
41
36
  }
42
37
  function defineDevConfig(swcConfig, options = {}) {
43
- preflight(options);
38
+ preflight();
44
39
  const {
45
40
  entry = path.resolve("./src/index.tsx"),
46
41
  https = false,
@@ -57,7 +52,7 @@ function defineDevConfig(swcConfig, options = {}) {
57
52
  // "process.env" is always available.
58
53
  environmentVariables = {},
59
54
  transformers = [],
60
- profile = false
55
+ verbose = false
61
56
  } = options;
62
57
  const config = {
63
58
  mode: "development",
@@ -115,7 +110,7 @@ function defineDevConfig(swcConfig, options = {}) {
115
110
  removeEmptyChunks: false,
116
111
  splitChunks: false
117
112
  },
118
- infrastructureLogging: profile ? {
113
+ infrastructureLogging: verbose ? {
119
114
  appendOnly: true,
120
115
  level: "verbose",
121
116
  debug: /PackFileCache/
@@ -187,7 +182,7 @@ function defineDevConfig(swcConfig, options = {}) {
187
182
  };
188
183
  const transformedConfig = applyTransformers(config, transformers, {
189
184
  environment: "dev",
190
- profile
185
+ verbose
191
186
  });
192
187
  return transformedConfig;
193
188
  }
@@ -6,7 +6,7 @@ function applyTransformers(config, transformers, context) {
6
6
  count += 1;
7
7
  return acc;
8
8
  }, config);
9
- if (context.profile) {
9
+ if (context.verbose) {
10
10
  if (count > 0) {
11
11
  console.log(`[webpack-configs] Applied ${count} configuration transformers.`);
12
12
  }
package/dist/dev.d.ts CHANGED
@@ -20,7 +20,7 @@ interface DefineDevConfigOptions {
20
20
  cssModules?: boolean;
21
21
  environmentVariables?: Record<string, unknown>;
22
22
  transformers?: WebpackConfigTransformer[];
23
- profile?: boolean;
23
+ verbose?: boolean;
24
24
  }
25
25
  declare function defineDevConfig(swcConfig: Config, options?: DefineDevConfigOptions): Configuration;
26
26
 
package/dist/dev.js CHANGED
@@ -1,3 +1,3 @@
1
- export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-IAMDZMFH.js';
1
+ export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-JJEPV2N2.js';
2
2
  import './chunk-P2Z3EEVF.js';
3
- import './chunk-EF2WO5MC.js';
3
+ import './chunk-QJI26K46.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig } from './chunk-NQR5SLK3.js';
2
- export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-IAMDZMFH.js';
1
+ export { defineBuildConfig, defineBuildHtmlWebpackPluginConfig, defineMiniCssExtractPluginConfig } from './chunk-GFNG2PBM.js';
2
+ export { defineDevConfig, defineDevHtmlWebpackPluginConfig, defineFastRefreshPluginConfig } from './chunk-JJEPV2N2.js';
3
3
  import './chunk-P2Z3EEVF.js';
4
- import './chunk-EF2WO5MC.js';
4
+ import './chunk-QJI26K46.js';
5
5
  export { addAfterModuleRule, addBeforeModuleRule, findModuleRule, findModuleRules, matchAssetModuleType, matchLoaderName, matchTest, removeModuleRules, replaceModuleRule } from './chunk-34O5ZLZ6.js';
6
6
  export { addAfterPlugin, addBeforePlugin, findPlugin, matchConstructorName, removePlugin, replacePlugin } from './chunk-JPURRV2F.js';
@@ -2,7 +2,7 @@ import { Configuration } from 'webpack';
2
2
 
3
3
  interface WebpackConfigTransformerContext {
4
4
  environment: "dev" | "build";
5
- profile: boolean;
5
+ verbose: boolean;
6
6
  }
7
7
  type WebpackConfigTransformer = (config: Configuration, context: WebpackConfigTransformerContext) => Configuration;
8
8
  declare function applyTransformers(config: Configuration, transformers: WebpackConfigTransformer[], context: WebpackConfigTransformerContext): Configuration;
@@ -1 +1 @@
1
- export { applyTransformers } from '../chunk-EF2WO5MC.js';
1
+ export { applyTransformers } from '../chunk-QJI26K46.js';
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@workleap/webpack-configs",
3
3
  "author": "Workleap",
4
4
  "description": "Workleap recommended webpack config.",
5
- "version": "1.0.4",
5
+ "version": "1.0.5",
6
6
  "license": "Apache-2.0",
7
7
  "keywords": [
8
8
  "workleap",
@@ -13,7 +13,8 @@
13
13
  "exports": {
14
14
  ".": {
15
15
  "import": "./dist/index.js",
16
- "types": "./dist/index.d.ts"
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
17
18
  }
18
19
  },
19
20
  "files": [
@@ -68,8 +69,8 @@
68
69
  "webpack-dev-server": "4.15.1",
69
70
  "@workleap/eslint-plugin": "2.1.0",
70
71
  "@workleap/swc-configs": "2.1.1",
71
- "@workleap/typescript-configs": "3.0.2",
72
- "@workleap/tsup-configs": "3.0.0"
72
+ "@workleap/tsup-configs": "3.0.0",
73
+ "@workleap/typescript-configs": "3.0.2"
73
74
  },
74
75
  "publishConfig": {
75
76
  "access": "public",