@mainset/bundler-webpack 0.2.0-rc.1 → 0.2.0-rc.3

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,13 +6,14 @@ import { commonWebpackConfigFragment } from './common.fragment.mjs';
6
6
  // The entry point for Global styles
7
7
  const cssGlobalStylesEntry = path.join(runtimePathById.src, 'styles', 'global.css');
8
8
  const scssGlobalStylesEntry = path.join(runtimePathById.src, 'styles', 'global.scss');
9
- const globalStylesEntry = fs.existsSync(scssGlobalStylesEntry)
10
- ? scssGlobalStylesEntry
11
- : cssGlobalStylesEntry;
9
+ const defaultEntry = [
10
+ resolveHostPackageNodeModulesPath('@mainset/bundler-webpack', '@babel/polyfill'),
11
+ ];
12
+ if (fs.existsSync(cssGlobalStylesEntry))
13
+ defaultEntry.push(cssGlobalStylesEntry);
14
+ if (fs.existsSync(scssGlobalStylesEntry))
15
+ defaultEntry.push(scssGlobalStylesEntry);
12
16
  const commonWebappWebpackConfigFragment = merge(commonWebpackConfigFragment, {
13
- entry: [
14
- resolveHostPackageNodeModulesPath('@mainset/bundler-webpack', '@babel/polyfill'),
15
- globalStylesEntry,
16
- ],
17
+ entry: defaultEntry,
17
18
  });
18
19
  export { commonWebappWebpackConfigFragment };
@@ -1,5 +1,6 @@
1
1
  import { runtimePathById } from '@mainset/cli/runtime';
2
2
  import { merge } from '@mainset/toolkit-js';
3
+ import CopyWebpackPlugin from 'copy-webpack-plugin';
3
4
  import fs from 'fs';
4
5
  import path from 'path';
5
6
  import { commonWebappWebpackConfigFragment } from './common-webapp.fragment.mjs';
@@ -9,5 +10,16 @@ const csrEntry = path.join(runtimePathById.src, 'index.csr.ts');
9
10
  const bundlerEntry = fs.existsSync(csrEntry) ? csrEntry : defaultEntry;
10
11
  const csrWebappWebpackConfigFragment = merge(commonWebappWebpackConfigFragment, {
11
12
  entry: [bundlerEntry],
13
+ plugins: [
14
+ new CopyWebpackPlugin({
15
+ patterns: [
16
+ {
17
+ from: path.join(runtimePathById.root, 'public'),
18
+ to: path.join(runtimePathById.dist),
19
+ noErrorOnMissing: true, // optional: don't error if public doesn't exist
20
+ },
21
+ ],
22
+ }),
23
+ ],
12
24
  });
13
25
  export { csrWebappWebpackConfigFragment };
@@ -1,5 +1,6 @@
1
1
  import { runtimePathById } from '@mainset/cli/runtime';
2
2
  import { merge } from '@mainset/toolkit-js';
3
+ import CopyWebpackPlugin from 'copy-webpack-plugin';
3
4
  import fs from 'fs';
4
5
  import path from 'path';
5
6
  import { commonWebappWebpackConfigFragment } from './common-webapp.fragment.mjs';
@@ -7,12 +8,24 @@ import { commonWebappWebpackConfigFragment } from './common-webapp.fragment.mjs'
7
8
  const defaultEntry = path.join(runtimePathById.src, 'index.ts');
8
9
  const ssrEntry = path.join(runtimePathById.src, 'index.ssr.ts');
9
10
  const bundlerEntry = fs.existsSync(ssrEntry) ? ssrEntry : defaultEntry;
11
+ const ssrPublicOutputPath = path.join(commonWebappWebpackConfigFragment.output.path, 'public');
10
12
  const ssrWebappWebpackConfigFragment = merge(
11
13
  // NOTE: the Web App config used to compile entry point of {global.css} styles
12
14
  commonWebappWebpackConfigFragment, {
13
15
  entry: [bundlerEntry],
14
16
  output: {
15
- path: path.join(commonWebappWebpackConfigFragment.output.path, 'public'),
17
+ path: ssrPublicOutputPath,
16
18
  },
19
+ plugins: [
20
+ new CopyWebpackPlugin({
21
+ patterns: [
22
+ {
23
+ from: path.join(runtimePathById.root, 'public'),
24
+ to: ssrPublicOutputPath,
25
+ noErrorOnMissing: true, // optional: don't error if public doesn't exist
26
+ },
27
+ ],
28
+ }),
29
+ ],
17
30
  });
18
31
  export { ssrWebappWebpackConfigFragment };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mainset/bundler-webpack",
3
- "version": "0.2.0-rc.1",
3
+ "version": "0.2.0-rc.3",
4
4
  "description": "Bundler for web apps",
5
5
  "homepage": "https://github.com/mainset/dev-stack-fe/tree/main/packages/bundler-webpack",
6
6
  "bugs": {
@@ -29,6 +29,7 @@
29
29
  "@babel/preset-react": "^7.27.1",
30
30
  "@babel/preset-typescript": "^7.27.1",
31
31
  "babel-loader": "^10.0.0",
32
+ "copy-webpack-plugin": "^13.0.0",
32
33
  "css-loader": "^7.1.2",
33
34
  "html-webpack-plugin": "^5.6.3",
34
35
  "mini-css-extract-plugin": "^2.9.2",
@@ -44,8 +45,8 @@
44
45
  "webpack-dev-server": "^5.2.2"
45
46
  },
46
47
  "devDependencies": {
47
- "@mainset/cli": "^0.2.0-rc.1",
48
48
  "@mainset/dev-stack-fe": "^0.1.1",
49
+ "@mainset/cli": "^0.2.0-rc.2",
49
50
  "@mainset/toolkit-js": "^0.1.0"
50
51
  },
51
52
  "peerDependencies": {