@genesislcap/webpack-builder 14.62.1 → 14.62.2-alpha-39ca39f.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.
@@ -51,7 +51,7 @@ const getFederationPlugins = (federatedIndexPresent, rootElement, options, pkg)
51
51
  ? [
52
52
  new html_webpack_plugin_1.default({
53
53
  title: `${pkg.description} (Federated)`,
54
- template: (0, node_path_1.resolve)(__dirname, '../../public/info.ejs'),
54
+ template: (0, node_path_1.resolve)(__dirname, '../../public/info.html'),
55
55
  filename: rootElement ? 'info.html' : 'index.html',
56
56
  inject: false,
57
57
  // Passing arbitrary data to the template for display
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/config/plugins.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAK3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgB7C,eAAO,MAAM,OAAO,QAAS,YAAY,KAAG,aAAa,CAAC,SAAS,CAgElE,CAAC"}
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/config/plugins.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAK3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAqB7C,eAAO,MAAM,OAAO,QAAS,YAAY,KAAG,aAAa,CAAC,SAAS,CAwElE,CAAC"}
@@ -15,25 +15,38 @@ const webpackbar_1 = tslib_1.__importDefault(require("webpackbar"));
15
15
  const workbox_webpack_plugin_1 = require("workbox-webpack-plugin");
16
16
  const federation_1 = require("./federation");
17
17
  const getTemplate = (cwd) => {
18
- const templateApp = (0, node_path_1.resolve)(cwd, 'public/index.ejs');
19
- const templateDefault = (0, node_path_1.resolve)(__dirname, '../public/index.ejs');
20
- const template = (0, node_fs_1.existsSync)(templateApp) ? templateApp : templateDefault;
21
- console.log(`Using index template: ${template}`);
22
- return template;
18
+ let selectedTemplate = (0, node_path_1.resolve)(__dirname, '../public/index.html');
19
+ const templateApp = (0, node_path_1.resolve)(cwd, 'index.html');
20
+ const templateAppPublic = (0, node_path_1.resolve)(cwd, 'public/index.ejs');
21
+ if ((0, node_fs_1.existsSync)(templateApp)) {
22
+ selectedTemplate = templateApp;
23
+ }
24
+ else if ((0, node_fs_1.existsSync)(templateAppPublic)) {
25
+ selectedTemplate = templateAppPublic;
26
+ }
27
+ console.log(`Using index template: ${selectedTemplate}`);
28
+ return `!!handlebars-loader!${selectedTemplate}`;
23
29
  };
24
30
  const plugins = (ctx) => {
25
31
  const { cli: { isAnalyze }, dirs: { cwd }, config: { serviceWorker, pwa, federation, app: { rootElement }, http, env, }, pkg, } = ctx;
26
32
  const federatedIndexPresent = (0, federation_1.federatedIndexExists)();
27
33
  const moduleFederationOptions = (0, federation_1.resolveFederationOptions)(federation, pkg);
28
34
  const define = (0, build_kit_1.resolveDefineConfig)(env, http);
35
+ const appPublic = (0, node_path_1.resolve)(cwd, 'public');
36
+ console.log('--webpack builder -- resolving app public', appPublic);
37
+ console.log('--webpack builder -- app public exists?', (0, node_fs_1.existsSync)(appPublic));
29
38
  return [
30
- new copy_webpack_plugin_1.default({
31
- patterns: [
32
- {
33
- from: (0, node_path_1.resolve)(__dirname, '../../public'),
34
- },
35
- ],
36
- }),
39
+ (0, node_fs_1.existsSync)(appPublic) &&
40
+ new copy_webpack_plugin_1.default({
41
+ patterns: [
42
+ // {
43
+ // from: resolve(__dirname, '../../public'),
44
+ // },
45
+ {
46
+ from: (0, node_path_1.resolve)(cwd, 'public'),
47
+ },
48
+ ],
49
+ }),
37
50
  new webpack_1.DefinePlugin(define),
38
51
  new webpackbar_1.default(),
39
52
  new mini_css_extract_plugin_1.default(),
@@ -1 +1 @@
1
- {"version":3,"file":"fileRules.d.ts","sourceRoot":"","sources":["../../../src/config/rules/fileRules.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;CAiBxB,CAAC"}
1
+ {"version":3,"file":"fileRules.d.ts","sourceRoot":"","sources":["../../../src/config/rules/fileRules.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;CAoBxB,CAAC"}
@@ -12,6 +12,9 @@ exports.appFileRules = {
12
12
  html: () => ({
13
13
  test: /\.html$/,
14
14
  use: [
15
+ // {
16
+ // loader: 'handlebars-loader',
17
+ // },
15
18
  {
16
19
  loader: 'html-loader',
17
20
  },
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8"/>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title><%= htmlWebpackPlugin.options.title %></title>
6
+ <title>{{htmlWebpackPlugin.options.title}}</title>
7
7
  <style>
8
8
  html,
9
9
  body {
@@ -18,6 +18,9 @@
18
18
  </style>
19
19
  </head>
20
20
  <body>
21
- <<%= htmlWebpackPlugin.options.customElementTagName %>></<%= htmlWebpackPlugin.options.customElementTagName %>>
21
+ <{{htmlWebpackPlugin.options.customElementTagName}}></{{htmlWebpackPlugin.options.customElementTagName}}>
22
+ {{#if insertEntryPoint}}
23
+ <script type="module" src="/src/index.ts"></script>
24
+ {{/if}}
22
25
  </body>
23
26
  </html>
@@ -2,12 +2,12 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
- <title><%= htmlWebpackPlugin.options.title %></title>
5
+ <title>{{htmlWebpackPlugin.options.title}}</title>
6
6
  </head>
7
7
  <body>
8
- <h1><%= htmlWebpackPlugin.options.title %></h1>
8
+ <h1>{{htmlWebpackPlugin.options.title}}</h1>
9
9
  <h3>Module Federation Details</h3>
10
- <pre><%= htmlWebpackPlugin.options.moduleFederationDetails %></pre>
10
+ <pre>{{htmlWebpackPlugin.options.moduleFederationDetails}}</pre>
11
11
  Read about <a href="https://webpack.js.org/concepts/module-federation/" target="_blank">Module Federation</a> in Webpack 5.
12
12
  </body>
13
- </html>
13
+ </html>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/webpack-builder",
3
3
  "description": "Webpack builder",
4
- "version": "14.62.1",
4
+ "version": "14.62.2-alpha-39ca39f.0",
5
5
  "license": "SEE LICENSE IN license.txt",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -12,13 +12,14 @@
12
12
  "dev": "tsc -b ./tsconfig.json -w"
13
13
  },
14
14
  "dependencies": {
15
- "@genesislcap/build-kit": "14.62.1",
15
+ "@genesislcap/build-kit": "14.62.2-alpha-39ca39f.0",
16
16
  "@module-federation/dashboard-plugin": "2.6.5",
17
17
  "@pixability-ui/federated-types": "^0.2.0",
18
18
  "camel-case": "^4.1.2",
19
19
  "consola": "^3.0.2",
20
20
  "copy-webpack-plugin": "^11.0.0",
21
21
  "css-loader": "^6.6.0",
22
+ "handlebars-loader": "^1.7.3",
22
23
  "html-loader": "^3.1.0",
23
24
  "html-webpack-plugin": "^5.3.1",
24
25
  "mini-css-extract-plugin": "^2.5.3",
@@ -53,5 +54,5 @@
53
54
  "publishConfig": {
54
55
  "access": "public"
55
56
  },
56
- "gitHead": "07db799664062919182c7c29fefab54b9c94fcfe"
57
+ "gitHead": "9faeaf6754a5eba4ef5f9f01452ec421d8846105"
57
58
  }
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8"/>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title><%= htmlWebpackPlugin.options.title %></title>
6
+ <title>{{htmlWebpackPlugin.options.title}}</title>
7
7
  <style>
8
8
  html,
9
9
  body {
@@ -18,6 +18,9 @@
18
18
  </style>
19
19
  </head>
20
20
  <body>
21
- <<%= htmlWebpackPlugin.options.customElementTagName %>></<%= htmlWebpackPlugin.options.customElementTagName %>>
21
+ <{{htmlWebpackPlugin.options.customElementTagName}}></{{htmlWebpackPlugin.options.customElementTagName}}>
22
+ {{#if insertEntryPoint}}
23
+ <script type="module" src="/src/index.ts"></script>
24
+ {{/if}}
22
25
  </body>
23
26
  </html>
@@ -2,12 +2,12 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
- <title><%= htmlWebpackPlugin.options.title %></title>
5
+ <title>{{htmlWebpackPlugin.options.title}}</title>
6
6
  </head>
7
7
  <body>
8
- <h1><%= htmlWebpackPlugin.options.title %></h1>
8
+ <h1>{{htmlWebpackPlugin.options.title}}</h1>
9
9
  <h3>Module Federation Details</h3>
10
- <pre><%= htmlWebpackPlugin.options.moduleFederationDetails %></pre>
10
+ <pre>{{htmlWebpackPlugin.options.moduleFederationDetails}}</pre>
11
11
  Read about <a href="https://webpack.js.org/concepts/module-federation/" target="_blank">Module Federation</a> in Webpack 5.
12
12
  </body>
13
- </html>
13
+ </html>
@@ -74,7 +74,7 @@ export const getFederationPlugins = (
74
74
  ? [
75
75
  new HtmlWebpackPlugin({
76
76
  title: `${pkg.description} (Federated)`,
77
- template: resolve(__dirname, '../../public/info.ejs'),
77
+ template: resolve(__dirname, '../../public/info.html'),
78
78
  filename: rootElement ? 'info.html' : 'index.html',
79
79
  inject: false,
80
80
  // Passing arbitrary data to the template for display
@@ -14,11 +14,16 @@ import { InjectManifest } from 'workbox-webpack-plugin';
14
14
  import { getFederationPlugins, federatedIndexExists, resolveFederationOptions } from './federation';
15
15
 
16
16
  const getTemplate = (cwd) => {
17
- const templateApp = resolve(cwd, 'public/index.ejs');
18
- const templateDefault = resolve(__dirname, '../public/index.ejs');
19
- const template = existsSync(templateApp) ? templateApp : templateDefault;
20
- console.log(`Using index template: ${template}`);
21
- return template;
17
+ let selectedTemplate = resolve(__dirname, '../public/index.html');
18
+ const templateApp = resolve(cwd, 'index.html');
19
+ const templateAppPublic = resolve(cwd, 'public/index.ejs');
20
+ if (existsSync(templateApp)) {
21
+ selectedTemplate = templateApp;
22
+ } else if (existsSync(templateAppPublic)) {
23
+ selectedTemplate = templateAppPublic;
24
+ }
25
+ console.log(`Using index template: ${selectedTemplate}`);
26
+ return `!!handlebars-loader!${selectedTemplate}`;
22
27
  };
23
28
 
24
29
  export const plugins = (ctx: BuildContext): Configuration['plugins'] => {
@@ -40,14 +45,22 @@ export const plugins = (ctx: BuildContext): Configuration['plugins'] => {
40
45
  const moduleFederationOptions = resolveFederationOptions(federation, pkg);
41
46
  const define = resolveDefineConfig(env, http);
42
47
 
48
+ const appPublic = resolve(cwd, 'public');
49
+ console.log('--webpack builder -- resolving app public', appPublic);
50
+ console.log('--webpack builder -- app public exists?', existsSync(appPublic));
51
+
43
52
  return [
44
- new CopyPlugin({
45
- patterns: [
46
- {
47
- from: resolve(__dirname, '../../public'),
48
- },
49
- ],
50
- }),
53
+ existsSync(appPublic) &&
54
+ new CopyPlugin({
55
+ patterns: [
56
+ // {
57
+ // from: resolve(__dirname, '../../public'),
58
+ // },
59
+ {
60
+ from: resolve(cwd, 'public'),
61
+ },
62
+ ],
63
+ }),
51
64
  new DefinePlugin(define),
52
65
  new WebpackBar(),
53
66
  new MiniCssExtractPlugin(),
@@ -10,6 +10,9 @@ export const appFileRules = {
10
10
  html: () => ({
11
11
  test: /\.html$/,
12
12
  use: [
13
+ // {
14
+ // loader: 'handlebars-loader',
15
+ // },
13
16
  {
14
17
  loader: 'html-loader',
15
18
  },