Skip to content

Commit 2da514b

Browse files
Webpack config TS version is used again.
1 parent cbd0957 commit 2da514b

File tree

7 files changed

+53
-58
lines changed

7 files changed

+53
-58
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dist
88
# Ignore Rush temporary files
99
/common/temp/**
1010

11-
# **/webpack.config.js
11+
**/webpack.config.js
1212
.rpt2_cache
1313
_src
1414
coverage

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "",
55
"main": "dist/index.js",
66
"scripts": {
7-
"start": "cross-env NODE_ENV=development webpack-dev-server",
8-
"build": "npm run build:tools && cross-end NODE_ENV=development webpack",
7+
"start": "npm run build:tools && cross-env NODE_ENV=development webpack-dev-server",
8+
"build": "npm run build:tools && cross-env NODE_ENV=development webpack",
99
"build:tools": "tsc -p ./tools"
1010
},
1111
"keywords": [],

src/components/text-field.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function useFieldId(props: Pick<TextFieldProps, "name">): string {
2323
return `${groupId}${SEPARATOR}${props.name}`;
2424
}
2525

26-
function useRegisterField(fieldId: string, props: TextFieldProps) {
26+
function useRegisterField(fieldId: string, props: TextFieldProps): void {
2727
useEffect(() => {
2828
const { store } = useContext(GroupContext);
2929

src/stores/group-store.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ export class GroupStoreMutable extends TinyEmitter<Callback> {
7777
this.emit();
7878
}
7979

80-
public toObject(): any {
81-
const result: { [key: string]: any } = {};
80+
public toObject(): unknown {
81+
const result: { [key: string]: unknown } = {};
8282
for (const key in this.fields) {
8383
if (this.fields.hasOwnProperty(key)) {
8484
const field = this.fields[key];

tools/webpack.config.ts

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,35 @@
1-
// import path from "path";
2-
// // Plugins
3-
// import webpackBuilder from "@reactway/webpack-builder";
4-
// import typeScript from "@reactway/webpack-builder-plugin-typescript";
5-
// import webpackDevServer from "@reactway/webpack-builder-plugin-web-dev";
6-
// import htmlPlugin from "@reactway/webpack-builder-plugin-html";
7-
// import styles from "@reactway/webpack-builder-plugin-styles";
8-
// import images from "@reactway/webpack-builder-plugin-images";
9-
// import clean from "@reactway/webpack-builder-plugin-clean";
10-
// import writeFile from "@reactway/webpack-builder-plugin-write-file";
11-
// // Packages not included to plugins.
12-
// // import CopyPlugin from "copy-webpack-plugin";
1+
const path = require("path");
2+
// Plugins
3+
const webpackBuilder = require("@reactway/webpack-builder");
4+
const typeScript = require("@reactway/webpack-builder-plugin-typescript");
5+
const webpackDevServer = require("@reactway/webpack-builder-plugin-web-dev");
6+
const htmlPlugin = require("@reactway/webpack-builder-plugin-html");
7+
const styles = require("@reactway/webpack-builder-plugin-styles");
8+
const images = require("@reactway/webpack-builder-plugin-images");
9+
const clean = require("@reactway/webpack-builder-plugin-clean");
10+
const writeFile = require("@reactway/webpack-builder-plugin-write-file");
11+
// Packages not included to plugins.
12+
// const CopyPlugin = require("copy-webpack-plugin");
1313

14-
// const fullOutputPath = path.resolve(__dirname, "dist");
14+
const fullOutputPath = path.resolve(__dirname, "dist");
1515

16-
// module.exports = new webpackBuilder.Builder(__dirname, {
17-
// entry: "./src/app.tsx",
18-
// mode: "development",
19-
// output: {
20-
// path: fullOutputPath,
21-
// filename: "[name].bundle.js"
22-
// }
23-
// })
24-
// .use(typeScript.TypeScriptPlugin)
25-
// .use(webpackDevServer)
26-
// .use(htmlPlugin)
27-
// .use(styles.StylesPlugin)
28-
// .use(images)
29-
// .use(clean)
30-
// .use(writeFile)
31-
// // .update(webpack => {
32-
// // if (webpack.plugins == null) {
33-
// // webpack.plugins = [];
34-
// // }
35-
// // webpack.plugins.push(
36-
// // new CopyPlugin([{ from: "src/assets/", to: "./assets" }])
37-
// // );
38-
// // return webpack;
39-
// // })
40-
// .toConfig();
16+
module.exports = new webpackBuilder.Builder(__dirname, {
17+
entry: "./src/app.tsx",
18+
mode: "development",
19+
output: {
20+
path: fullOutputPath,
21+
filename: "[name].bundle.js"
22+
}
23+
})
24+
.use(typeScript.TypeScriptPlugin)
25+
.use(webpackDevServer)
26+
.use(htmlPlugin)
27+
.use(styles.StylesPlugin)
28+
.use(images)
29+
.use(clean)
30+
.use(writeFile)
31+
// .update(webpack => {
32+
// webpack.plugins.push(new CopyPlugin([{ from: "src/assets/", to: "./assets" }]));
33+
// return webpack;
34+
// })
35+
.toConfig();

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
"ignoreDefinitionFiles": true
1212
}
1313
]
14-
}
14+
},
15+
"exclude": ["tools"]
1516
}

webpack.config.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
const path = require("path");
1+
"use strict";
2+
var path = require("path");
23
// Plugins
3-
const webpackBuilder = require("@reactway/webpack-builder");
4-
const typeScript = require("@reactway/webpack-builder-plugin-typescript");
5-
const webpackDevServer = require("@reactway/webpack-builder-plugin-web-dev");
6-
const htmlPlugin = require("@reactway/webpack-builder-plugin-html");
7-
const styles = require("@reactway/webpack-builder-plugin-styles");
8-
const images = require("@reactway/webpack-builder-plugin-images");
9-
const clean = require("@reactway/webpack-builder-plugin-clean");
10-
const writeFile = require("@reactway/webpack-builder-plugin-write-file");
4+
var webpackBuilder = require("@reactway/webpack-builder");
5+
var typeScript = require("@reactway/webpack-builder-plugin-typescript");
6+
var webpackDevServer = require("@reactway/webpack-builder-plugin-web-dev");
7+
var htmlPlugin = require("@reactway/webpack-builder-plugin-html");
8+
var styles = require("@reactway/webpack-builder-plugin-styles");
9+
var images = require("@reactway/webpack-builder-plugin-images");
10+
var clean = require("@reactway/webpack-builder-plugin-clean");
11+
var writeFile = require("@reactway/webpack-builder-plugin-write-file");
1112
// Packages not included to plugins.
1213
// const CopyPlugin = require("copy-webpack-plugin");
13-
14-
const fullOutputPath = path.resolve(__dirname, "dist");
15-
14+
var fullOutputPath = path.resolve(__dirname, "dist");
1615
module.exports = new webpackBuilder.Builder(__dirname, {
1716
entry: "./src/app.tsx",
1817
mode: "development",
@@ -32,4 +31,4 @@ module.exports = new webpackBuilder.Builder(__dirname, {
3231
// webpack.plugins.push(new CopyPlugin([{ from: "src/assets/", to: "./assets" }]));
3332
// return webpack;
3433
// })
35-
.toConfig();
34+
.toConfig();

0 commit comments

Comments
 (0)