@stanlemon/webdev 0.1.20 → 0.1.23

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": "@stanlemon/webdev",
3
- "version": "0.1.20",
3
+ "version": "0.1.23",
4
4
  "description": "My typical web development setup, but without all the copy and paste.",
5
5
  "keywords": [
6
6
  "webpack",
@@ -15,6 +15,7 @@
15
15
  },
16
16
  "type": "module",
17
17
  "scripts": {
18
+ "test": "WEBDEV_ENTRY=./test.tsx webpack build",
18
19
  "lint": "eslint --ext js,jsx,ts,tsx ./",
19
20
  "lint:format": "eslint --fix --ext js,jsx,ts,tsx ./"
20
21
  },
@@ -44,10 +45,10 @@
44
45
  "jest": "^27.5.1",
45
46
  "less": "^4.1.2",
46
47
  "less-loader": "^10.2.0",
47
- "prettier": "^2.6.1",
48
+ "prettier": "^2.6.2",
48
49
  "react": "^18.0.0",
49
50
  "react-dom": "^18.0.0",
50
- "react-refresh": "^0.12.0",
51
+ "react-refresh": "^0.11.0",
51
52
  "style-loader": "^3.3.1",
52
53
  "typescript": "^4.6.3",
53
54
  "webpack": "^5.71.0",
package/test.tsx ADDED
@@ -0,0 +1,11 @@
1
+ import ReactDOM from "react-dom";
2
+
3
+ type Props = {
4
+ name: string;
5
+ };
6
+
7
+ function App({ name }: Props) {
8
+ return <div>Hello {name}!</div>;
9
+ }
10
+
11
+ ReactDOM.render(<App name="world" />, document.getElementById("root"));
package/webpack.config.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import path from "path";
2
- import { readFileSync } from "fs";
2
+ import { readFileSync, existsSync } from "fs";
3
3
  import webpack from "webpack";
4
4
  import HtmlWebpackPlugin from "html-webpack-plugin";
5
5
  import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
@@ -121,8 +121,8 @@ export default {
121
121
  }
122
122
  return new HtmlWebpackPlugin({
123
123
  filename: path.basename(html),
124
- template: html,
125
124
  inject,
125
+ ...(existsSync(html) ? { template: html } : {}),
126
126
  });
127
127
  }),
128
128
  new webpack.DefinePlugin({